2017-11-16 00:43:27 +01:00
|
|
|
from argparse import ArgumentParser
|
2024-07-12 02:30:23 +02:00
|
|
|
from typing import Any
|
2016-06-04 16:52:18 +02:00
|
|
|
|
2023-10-12 19:43:45 +02:00
|
|
|
from typing_extensions import override
|
2017-11-16 00:43:27 +01:00
|
|
|
|
|
|
|
from zerver.lib.cache_helpers import cache_fillers, fill_remote_cache
|
2024-05-24 16:49:56 +02:00
|
|
|
from zerver.lib.management import ZulipBaseCommand
|
2013-01-14 17:51:18 +01:00
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2024-05-24 16:49:56 +02:00
|
|
|
class Command(ZulipBaseCommand):
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2017-10-26 11:35:57 +02:00
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
2022-03-25 23:37:10 +01:00
|
|
|
parser.add_argument(
|
|
|
|
"--cache", help="Populate one specific cache", choices=cache_fillers.keys()
|
|
|
|
)
|
2013-01-14 17:51:18 +01:00
|
|
|
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2024-07-12 02:30:23 +02:00
|
|
|
def handle(self, *args: Any, **options: str | None) -> None:
|
2013-03-26 17:24:02 +01:00
|
|
|
if options["cache"] is not None:
|
2016-06-04 16:52:18 +02:00
|
|
|
fill_remote_cache(options["cache"])
|
|
|
|
return
|
2013-03-26 17:24:02 +01:00
|
|
|
|
2022-12-12 03:39:16 +01:00
|
|
|
for cache in cache_fillers:
|
2016-03-31 03:43:22 +02:00
|
|
|
fill_remote_cache(cache)
|