diff --git a/mailman_sync.py b/mailman_sync.py index 399013f..cd2533a 100755 --- a/mailman_sync.py +++ b/mailman_sync.py @@ -103,7 +103,8 @@ def main(mailman_bin: Path, api: str, api_auth: str, list_suffix: str, dry_run: print(f"Skipping {list_name}, as it does not exist in Mailman") -if __name__ == "__main__": + +def parse_arguments(): argp = argparse.ArgumentParser(description=__doc__) argp.add_argument( "--bin", @@ -119,7 +120,11 @@ if __name__ == "__main__": action="store_true", help="Don't make changes, just print what would happen", ) - args = argp.parse_args() + return argp.parse_args() + + +if __name__ == "__main__": + args = parse_arguments() if "API_AUTH" in os.environ: api_auth = os.environ.get("API_AUTH")