mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 14:23:09 +00:00
9ef47a43a4
When reporting whether a boolean flag was seen report the actual flags rather than a summary count. For example, if you have option spec `h/help` and we parse `-h --help -h` don't do the equivalent of `set _flag_h 3` do `set _flag_h -h --help -h`. Partial fix for #4226
44 lines
911 B
Text
44 lines
911 B
Text
# No args
|
|
# One arg and no matching flags
|
|
argv help
|
|
# Five args with two matching a flag
|
|
_flag_h '--help' '-h'
|
|
_flag_help '--help' '-h'
|
|
argv '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 --help
|
|
_flag_help --help
|
|
argv 'help' 'me'
|
|
# --stop-nonopt works
|
|
_flag_a A2
|
|
_flag_abc A2
|
|
_flag_h -h
|
|
_flag_help -h
|
|
argv 'non-opt' 'second non-opt' '--help'
|
|
# Implicit int flags work
|
|
_flag_val 123
|
|
argv 'abc' 'def'
|
|
_flag_t woohoo
|
|
_flag_token woohoo
|
|
_flag_v '-v' '--verbose'
|
|
_flag_val -234
|
|
_flag_verbose '-v' '--verbose'
|
|
argv 'a1' 'a2'
|
|
# Should be set to 987
|
|
_flag_m 987
|
|
_flag_max 987
|
|
argv 'argle' 'bargle'
|
|
# Should be set to 765
|
|
_flag_m 765
|
|
_flag_max 765
|
|
argv 'argle' 'bargle'
|
|
# Check the exit status from argparse validation
|
|
_flag_name max
|
|
_flag_value 83
|
|
expected argparse return status 57
|