Skip to content

Commit

Permalink
Give proper error on missing short flag
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Sep 12, 2021
1 parent 9704659 commit 514739a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/interp/args.jq
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def args_parse($args; $opts):
( $arg[0:2] as $arg
| $flagmap[$arg] as $optname
| ($opts[$optname]? // null) as $opt
| if $opt and $opt.bool then
| if $opt == null then
error("\($arg): no such argument")
elif $opt.bool then
_parse_without_arg((["-"+$args[0][2:]]+$args[1:]); $optname)
else
error("\($arg): needs an argument")
Expand Down

0 comments on commit 514739a

Please sign in to comment.