[scripts/init] add '-M/--no-module' command-line option
This commit is contained in:
@@ -30,12 +30,16 @@ LICENSE = """\
|
|||||||
|
|
||||||
|
|
||||||
def init_extractor_module(opts):
|
def init_extractor_module(opts):
|
||||||
try:
|
if opts["init_module"]:
|
||||||
create_extractor_module(opts)
|
try:
|
||||||
except FileExistsError:
|
create_extractor_module(opts)
|
||||||
LOG.warning("… already present")
|
except FileExistsError:
|
||||||
except Exception as exc:
|
LOG.warning("… already present")
|
||||||
LOG.error("%s: %s", exc.__class__.__name__, exc, exc_info=exc)
|
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:
|
try:
|
||||||
create_test_results_file(opts)
|
create_test_results_file(opts)
|
||||||
@@ -44,9 +48,6 @@ def init_extractor_module(opts):
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
LOG.error("%s: %s", exc.__class__.__name__, exc, exc_info=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 opts.get("site_name"):
|
||||||
if msg := insert_into_supportedsites(opts):
|
if msg := insert_into_supportedsites(opts):
|
||||||
LOG.warning(msg)
|
LOG.warning(msg)
|
||||||
@@ -321,26 +322,31 @@ def parse_args(args=None):
|
|||||||
parser = argparse.ArgumentParser(args)
|
parser = argparse.ArgumentParser(args)
|
||||||
|
|
||||||
parser.add_argument("-s", "--site", metavar="TITLE")
|
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", "--copyright", metavar="NAME")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-C",
|
"-C",
|
||||||
action="store_const", const="Mike Fährmann", dest="copyright")
|
action="store_const", const="Mike Fährmann", dest="copyright")
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-F", "--force",
|
"-F", "--force",
|
||||||
action="store_const", const="w", default="x", dest="open_mode")
|
action="store_const", const="w", default="x", dest="open_mode")
|
||||||
parser.add_argument(
|
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")
|
action="store_const", const="manga", dest="type")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-B", "--base",
|
"--base",
|
||||||
action="store_const", const="base", dest="type")
|
action="store_const", const="base", dest="type")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-U", "--user",
|
"--user",
|
||||||
action="store_const", const="user", dest="type")
|
action="store_const", const="user", dest="type")
|
||||||
|
|
||||||
parser.add_argument("category")
|
parser.add_argument("category")
|
||||||
parser.add_argument("root")
|
parser.add_argument("root", nargs="?")
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
@@ -354,6 +360,7 @@ def parse_opts(args=None):
|
|||||||
"type" : args.type,
|
"type" : args.type,
|
||||||
"open_mode" : args.open_mode,
|
"open_mode" : args.open_mode,
|
||||||
"copyright" : args.copyright,
|
"copyright" : args.copyright,
|
||||||
|
"init_module": args.module,
|
||||||
}
|
}
|
||||||
|
|
||||||
if root := args.root:
|
if root := args.root:
|
||||||
|
|||||||
Reference in New Issue
Block a user