35 multi_opt: bool =
False,
36 dag_opt: bool =
False,
39 """Parser for the prefix command itself, relying on ArgumentParser."""
41 parser = ArgumentParser(add_help=
False)
43 parser.add_argument(
"exec", nargs=
"?")
45 parser.add_argument(
"-b",
"--background", action=
"store_true")
46 parser.add_argument(
"-d",
"--dry-run", action=
"store_true")
48 parser.add_argument(
"-D",
"--dag", type=Path)
50 parser.add_argument(
"-n",
"--memory-needs", type=int, default=1024)
53 parser.add_argument(
"-h",
"--help", action=
"store_true")
54 parser.add_argument(
"-t",
"--tutorial", action=
"store_true")
55 parser.add_argument(
"-g",
"--git", action=
"store_true")
57 parser.add_argument(
"-e",
"--example", action=
"store_true")
60 parser.add_argument(
"-v",
"--verbose", action=
"store_true")
61 parser.add_argument(
"-m",
"--mute", action=
"store_true")
62 parser.add_argument(
"-f",
"--fill", action=
"store_true")
63 parser.add_argument(
"-F",
"--Friend", action=
"store_true")
64 parser.add_argument(
"-s",
"--syst", action=
"store_true")
65 parser.add_argument(
"-c",
"--config", type=Path)
66 parser.add_argument(
"-j",
"--nSplit", type=int, default=NPROC)
69 cmds, args = parser.parse_known_intermixed_args(argv[1:])
71 if any(x
in args
for x
in [
"-k",
"--nNow"]):
72 raise ValueError(
"Giving `-k` or `--nNow` is meaningless in this context.")
73 unknown_explicit_args = [arg
for arg
in args
if arg[0] ==
"-"]
74 if len(unknown_explicit_args) > 0:
76 f
"No unknown explicit option is allowed: {unknown_explicit_args}"
91 args += [
"-c", str(cmds.config.absolute())]
94 if cmds.help
or len(argv) == 1:
95 prefix = os.path.basename(sys.argv[0])
97 f
"\33[1m{prefix} exec args [...]\33[0m",
98 "where\texec = a command using `Darwin::Tools::Options` with `Darwin::Tools::split`",
99 "\targs = the arguments of the same command, one being called exactly `output`",
104 lines = textwrap.TextWrapper(width=80).wrap(text=tutorial)
105 print(*lines, sep=
"\n")