You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flags: interaction between default_missing and allow_negative_numbers #1316
allow_negative_numbers is enabled by default for flags (see --apps flag)
but if default_missing is specified, then allow_negative_numbers becomes disabled (see --jobs flag), unless allow_negative_numbers is enabled manually (see --kids flag).
#!/usr/bin/env -S usage bash#USAGE name "flag-test"#USAGE flag "--apps <N>"#USAGE flag "--jobs <N>" default_missing="default missing"#USAGE flag "--kids <N>" default_missing="default missing" allow_negative_numbers=#trueset -euo pipefail
echo"usage_apps=${usage_apps:-unset}"echo"usage_jobs=${usage_jobs:-unset}"echo"usage_kids=${usage_kids:-unset}"
$ usage explain -f flag-test.sh -- ./flag-test.sh --apps -1
./flag-test.sh --apps -1
command
tokens
[0] ./flag-test.sh program
[1] --apps flag --apps
[2] -1 value of apps = "-1"
values
flag --apps -1 argv [2]
$ usage explain -f flag-test.sh -- ./flag-test.sh --jobs -1
./flag-test.sh --jobs -1
the parse stopped before the environment and defaults were applied,
so only what argv bound is shown
tokens
[0] ./flag-test.sh program
[1] --jobs flag --jobs
[2] -1 refused, no declaration takes this word
refused
unexpected word: -1
$ usage explain -f flag-test.sh -- ./flag-test.sh --kids -1
./flag-test.sh --kids -1
command
tokens
[0] ./flag-test.sh program
[1] --kids flag --kids
[2] -1 value of kids = "-1"
values
flag --kids -1 argv [2]
Activity
muzimuzhi commentedon Aug 25, 2026
The
usage explainoutput