From 0364092241642ffe00a5e8f668b1d02ecbee7e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 5 Aug 2025 19:52:00 +0200 Subject: [PATCH] [scripts/init] add '-M/--no-module' command-line option --- scripts/init.py | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/scripts/init.py b/scripts/init.py index d47884a8..73864f79 100755 --- a/scripts/init.py +++ b/scripts/init.py @@ -30,12 +30,16 @@ LICENSE = """\ def init_extractor_module(opts): - try: - create_extractor_module(opts) - except FileExistsError: - LOG.warning("… already present") - except Exception as exc: - LOG.error("%s: %s", exc.__class__.__name__, exc, exc_info=exc) + if opts["init_module"]: + try: + create_extractor_module(opts) + except FileExistsError: + LOG.warning("… already present") + except Exception as exc: + LOG.error("%s: %s", exc.__class__.__name__, exc, exc_info=exc) + + if msg := insert_into_modules_list(opts): + LOG.warning(msg) try: create_test_results_file(opts) @@ -44,9 +48,6 @@ def init_extractor_module(opts): except Exception as exc: LOG.error("%s: %s", exc.__class__.__name__, exc, exc_info=exc) - if msg := insert_into_modules_list(opts): - LOG.warning(msg) - if opts.get("site_name"): if msg := insert_into_supportedsites(opts): LOG.warning(msg) @@ -321,26 +322,31 @@ def parse_args(args=None): parser = argparse.ArgumentParser(args) parser.add_argument("-s", "--site", metavar="TITLE") - parser.add_argument("-t", "--type", metavar="TYPE") parser.add_argument("-c", "--copyright", metavar="NAME") parser.add_argument( "-C", action="store_const", const="Mike Fährmann", dest="copyright") + parser.add_argument( "-F", "--force", action="store_const", const="w", default="x", dest="open_mode") parser.add_argument( - "-M", "--manga", + "-M", "--no-module", + dest="module", action="store_false") + + parser.add_argument("-t", "--type", metavar="TYPE") + parser.add_argument( + "--manga", action="store_const", const="manga", dest="type") parser.add_argument( - "-B", "--base", + "--base", action="store_const", const="base", dest="type") parser.add_argument( - "-U", "--user", + "--user", action="store_const", const="user", dest="type") parser.add_argument("category") - parser.add_argument("root") + parser.add_argument("root", nargs="?") return parser.parse_args() @@ -354,6 +360,7 @@ def parse_opts(args=None): "type" : args.type, "open_mode" : args.open_mode, "copyright" : args.copyright, + "init_module": args.module, } if root := args.root: