fish-shell/tests/argparse.out
Kurtis Rader 63d601610d implement -nnn style flags in argparse
This implements support for numeric flags without an associated short or
long flag name. This pattern is used by many commands. For example `head
-3 /a/file` to emit the first three lines of the file.

Fixes #4214
2017-07-13 20:36:59 -07:00

45 lines
692 B
Text

# No args
# One arg and no matching flags
argv help
count=1
|help|
# Five args with two matching a flag
_flag_h 2
_flag_help 2
argv 'help' 'me' 'a lot more'
count=3
|help|
|me|
|a lot more|
# Required, optional, and multiple flags
_flag_a ABC
_flag_abc ABC
_flag_d
_flag_def
_flag_g 'g1' 'g2' 'g3'
_flag_ghk 'g1' 'g2' 'g3'
_flag_h 1
_flag_help 1
argv 'help' 'me'
count=2
|help|
|me|
# --stop-nonopt works
_flag_a A2
_flag_abc A2
_flag_h 1
_flag_help 1
argv 'non-opt' 'second non-opt' '--help'
count=3
|non-opt|
|second non-opt|
|--help|
# A "#-val" spec works
_flag_val 123
argv 'abc' 'def'
_flag_t woohoo
_flag_token woohoo
_flag_v 2
_flag_val -234
_flag_verbose 2
argv 'a1' 'a2'