Skip to content

Commit d3fbbf9

Browse files
Jayman2000abathur
authored andcommitted
Add run0 parser
I tested this parser using this script: #!/usr/bin/env bash run0 \ -h --help \ -V --version \ --no-ask-password \ --machine=CONTAINER \ --unit=UNIT \ --property=NAME=VALUE \ --description=TEXT \ --slice=SLICE \ --slice-inherit \ -u USER --user=USER \ -g GROUP --group=GROUP \ --nice=NICE \ -D PATH --chdir=PATH \ --setenv=NAME \ --background=COLOR \ --pty \ --pipe \ --shell-prompt-prefix=PREFIX \ hello run0 \ -h --help \ -V --version \ --no-ask-password \ --machine=CONTAINER \ --unit=UNIT \ --property=NAME=VALUE \ --description=TEXT \ --slice=SLICE \ --slice-inherit \ -u USER --user=USER \ -g GROUP --group=GROUP \ --nice=NICE \ -D PATH --chdir=PATH \ --setenv=NAME \ --background=COLOR \ --pty \ --pipe \ --shell-prompt-prefix=PREFIX \ -- \ hello run0 -- run0 -- hello run0 run0 hello run0 run0 -u hello hello I was able to successfully resholve that script by running this command: NIX_CONFIG='extra-experimental-features = nix-command flakes' nix run <path to resholve repo>#resholve-with-packages -- <path to script> systemd hello
1 parent 945336f commit d3fbbf9

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

resholve

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,57 @@ class ExternalCommandParsers(object):
25792579

25802580
return (generic,)
25812581

2582+
@staticmethod
2583+
def _run0():
2584+
"""
2585+
This was based on running "run0 --help" with systemd v257.6.
2586+
2587+
This was also based on some manual testing because the "--" argument
2588+
wasn't documented [1].
2589+
2590+
[1]: <https://github.com/systemd/systemd/issues/37961>
2591+
"""
2592+
generic = CommandParser("run0")
2593+
generic.add_argument(
2594+
"-h",
2595+
"--help",
2596+
"-V",
2597+
"--version",
2598+
"--no-ask-password",
2599+
action="store_true"
2600+
)
2601+
generic.add_argument(
2602+
"--machine",
2603+
"--unit",
2604+
"--property",
2605+
"--description",
2606+
"--slice",
2607+
nargs=1
2608+
)
2609+
generic.add_argument("--slice-inherit", action="store_true")
2610+
generic.add_argument(
2611+
"-u",
2612+
"--user",
2613+
"-g",
2614+
"--group",
2615+
"--nice",
2616+
"-D",
2617+
"--chdir",
2618+
"--setenv",
2619+
"--background",
2620+
nargs=1
2621+
)
2622+
generic.add_argument(
2623+
"--pty",
2624+
"--pipe",
2625+
action="store_true"
2626+
)
2627+
generic.add_argument("--shell-prompt-prefix", nargs=1)
2628+
generic.add_argument(
2629+
"commands", nargs="*", action="invocations"
2630+
)
2631+
return (generic,)
2632+
25822633

25832634
def generate_builtin_command_parser(cmdname):
25842635
cmdname = "_" + cmdname

0 commit comments

Comments
 (0)