From 514739a14986ee5182a2b1cc417c7851f32d187b Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Mon, 9 Aug 2021 12:37:48 +0200 Subject: [PATCH] Give proper error on missing short flag --- pkg/interp/args.jq | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/interp/args.jq b/pkg/interp/args.jq index 82cdb3cca..d9e20f5f6 100644 --- a/pkg/interp/args.jq +++ b/pkg/interp/args.jq @@ -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")