clean_unused_caches: Allow the main function to accept `Namespace` args.

This commit will allow us to pass the arguments in the
'clean...' functions when calling the `main` function (in
`provision`). It also changes args parsing
function location to `if __name__ == "__main__"` block as
we wouldn't need it to parse args when we call the
function.
This commit is contained in:
Riken Shah 2021-06-11 19:24:36 +00:00 committed by Tim Abbott
parent 4f54e15993
commit 45af71e33b
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse
import os import os
import sys import sys
@ -8,8 +9,7 @@ from scripts.lib import clean_emoji_cache, clean_node_cache, clean_venv_cache, c
from scripts.lib.zulip_tools import parse_cache_script_args from scripts.lib.zulip_tools import parse_cache_script_args
def main() -> None: def main(args: argparse.Namespace) -> None:
args = parse_cache_script_args("This script cleans unused Zulip caches.")
os.chdir(ZULIP_PATH) os.chdir(ZULIP_PATH)
clean_venv_cache.main(args) clean_venv_cache.main(args)
clean_node_cache.main(args) clean_node_cache.main(args)
@ -18,4 +18,5 @@ def main() -> None:
if __name__ == "__main__": if __name__ == "__main__":
main() args = parse_cache_script_args("This script cleans unused Zulip caches.")
main(args)