Skip to content

Commit

Permalink
refactor: argc-eval generated script
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Jul 20, 2023
1 parent 2401b30 commit 3f3c112
Show file tree
Hide file tree
Showing 33 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/argc_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl ArgcValue {
}
}
ArgcValue::Error((error, exit)) => {
return format!("cat >&2 <<-'EOF' \n{}\nEOF\nexit {}", error, exit)
return format!("command cat >&2 <<-'EOF' \n{}\nEOF\nexit {}", error, exit)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog abc

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: `prog` requires a subcommand but one was not provided
[subcommands: cmd]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmd

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmd <COMMAND>

COMMANDS:
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/integration__main_fn__subcmd_no_main.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog <COMMAND>

COMMANDS:
Expand Down
36 changes: 18 additions & 18 deletions tests/snapshots/integration__spec__arg_subcmd_help.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ expression: data
prog cmda -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmda

EOF
Expand All @@ -16,7 +16,7 @@ exit 0
prog cmdb -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdb [VAL]

ARGS:
Expand All @@ -29,7 +29,7 @@ exit 0
prog cmdc -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdc [VAL]...

ARGS:
Expand All @@ -42,7 +42,7 @@ exit 0
prog cmdd -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdd <VAL>...

ARGS:
Expand All @@ -55,7 +55,7 @@ exit 0
prog cmde -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmde <VAL>

ARGS:
Expand All @@ -68,7 +68,7 @@ exit 0
prog cmdf -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdf [VAL]

ARGS:
Expand All @@ -81,7 +81,7 @@ exit 0
prog cmdg -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdg [VAL]

ARGS:
Expand All @@ -94,7 +94,7 @@ exit 0
prog cmdh -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdh [VAL]

ARGS:
Expand All @@ -107,7 +107,7 @@ exit 0
prog cmdi -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdi [VAL]

ARGS:
Expand All @@ -120,7 +120,7 @@ exit 0
prog cmdj -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdj [VAL]

ARGS:
Expand All @@ -133,7 +133,7 @@ exit 0
prog cmdk -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdk [VAL]

ARGS:
Expand All @@ -146,7 +146,7 @@ exit 0
prog cmdl -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdl [VAL]...

ARGS:
Expand All @@ -159,7 +159,7 @@ exit 0
prog cmdm -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdm <VAL>

ARGS:
Expand All @@ -172,7 +172,7 @@ exit 0
prog cmdn -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdn <VAL>...

ARGS:
Expand All @@ -185,7 +185,7 @@ exit 0
prog cmdo -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdo [FILE]

ARGS:
Expand All @@ -198,7 +198,7 @@ exit 0
prog cmdp -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdp [VAL1]... [VAL2]...

ARGS:
Expand All @@ -212,7 +212,7 @@ exit 0
prog cmdq -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdq <VAL1> <VAL2>...

ARGS:
Expand All @@ -226,7 +226,7 @@ exit 0
prog cmdr -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdr <VAL1> <VAL2> <VAL3>

ARGS:
Expand Down
6 changes: 3 additions & 3 deletions tests/snapshots/integration__spec__option_help.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ expression: data
prog cmda -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmda [OPTIONS]

OPTIONS:
Expand Down Expand Up @@ -35,7 +35,7 @@ exit 0
prog cmdb -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdb --oa <OA> --ob <OB>... --oc <OC>... --oca <OCA> --ocb <OCB>... --occ <OCC>...

OPTIONS:
Expand All @@ -54,7 +54,7 @@ exit 0
prog cmdc -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdc [OPTIONS]

OPTIONS:
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/integration__spec__option_multi_vals.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog [OPTIONS]

OPTIONS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog -h

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog [OPTIONS] [URL]

ARGS:
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/integration__validate__arg_choice.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmdh val

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: invalid value `val` for `[VAL]`
[possible values: x, y, z]

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/integration__validate__arg_choice_fn.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmdj val

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: invalid value `val` for `[VAL]`
[possible values: abc, def, ghi]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmdl abc val

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: invalid value `val` for `[VAL]...`
[possible values: abc, def, ghi]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog help cmdd

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
USAGE: prog cmdd <VAL>...

ARGS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog foo

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: `prog` requires a subcommand but one was not provided
[subcommands: cmda, cmdb]

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/integration__validate__arg_missing.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmdd

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: the following required arguments were not provided:
<VAL>...

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/integration__validate__arg_unknown.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmdb v1 v2

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: unexpected argument `v2` found

USAGE: prog cmdb [VAL]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ expression: data
prog --fa foo

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: invalid value `foo` for `[VAL]`
[possible values: abc]

Expand All @@ -19,7 +19,7 @@ exit 1
prog foo

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: invalid value `foo` for `[VAL]`
[possible values: def]

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/integration__validate__empty_choices.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ expression: data
prog --oa foo

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: invalid value `foo` for `<OA>`
[possible values: ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmda -a -a

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: the argument `-a` cannot be used multiple times

USAGE: prog cmda [OPTIONS]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN
prog cmda -a=3

OUTPUT
cat >&2 <<-'EOF'
command cat >&2 <<-'EOF'
error: unexpected value `3` for `-a` found; no more were expected

USAGE: prog cmda [OPTIONS]
Expand Down
Loading

0 comments on commit 3f3c112

Please sign in to comment.