From 1787478d6b645f0a6789f55f9c603467e53ccc65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 23 Aug 2025 17:24:21 +0200 Subject: [PATCH] [scripts/supportedsites] add 'main()' function --- scripts/supportedsites.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index ba72db63..7557b8e2 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -741,8 +741,14 @@ Consider all listed sites to potentially be NSFW. """ -categories, domains = build_extractor_list() -PATH = (sys.argv[1] if len(sys.argv) > 1 else - util.path("docs", "supportedsites.md")) -with util.lazy(PATH) as fp: - fp.write(generate_output(COLUMNS, categories, domains)) +def main(path=None): + categories, domains = build_extractor_list() + + if path is None: + path = util.path("docs", "supportedsites.md") + with util.lazy(path) as fp: + fp.write(generate_output(COLUMNS, categories, domains)) + + +if __name__ == "__main__": + main(sys.argv[1] if len(sys.argv) > 1 else None)