mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 02:31:18 -03:00
fix argparse handling of short flag only specs
@faho noticed that option specs which don't have a long flag name are not handled correctly. This fixes that and adds unit tests. Fixes #4232
This commit is contained in:
@@ -38,6 +38,25 @@ argv 'argle' 'bargle'
|
||||
_flag_m 765
|
||||
_flag_max 765
|
||||
argv 'argle' 'bargle'
|
||||
# Bool short flag only
|
||||
_flag_C -C
|
||||
_flag_v '-v' '-v'
|
||||
argv 'arg1' 'arg2'
|
||||
# Value taking short flag only
|
||||
_flag_v '--verbose' '-v'
|
||||
_flag_verbose '--verbose' '-v'
|
||||
_flag_x arg2
|
||||
argv arg1
|
||||
# Implicit int short flag only
|
||||
_flag_v '-v' '-v' '-v'
|
||||
_flag_verbose '-v' '-v' '-v'
|
||||
_flag_x 321
|
||||
argv 'argle' 'bargle'
|
||||
# Implicit int short flag only with custom validation passes
|
||||
_flag_v '-v' '-v' '-v'
|
||||
_flag_verbose '-v' '-v' '-v'
|
||||
_flag_x 499
|
||||
argv
|
||||
# Check the exit status from argparse validation
|
||||
_flag_name max
|
||||
_flag_value 83
|
||||
|
||||
Reference in New Issue
Block a user