fish-shell/tests/argparse.err
Kurtis Rader 3e226f0a5e implement a new implicit int option spec
While updating the `history` function to use `argparse` I realized it is
useful to define an option that can be used in three ways. First by
using the short flag; e.g., `-n NNN`. Second by using the long flag;
e.g., `--max NNN`. Third, as an implicit int flag; e.g., `-NNN`. This
use case is now supported by a spec of the form `n#max`.
2017-07-16 18:27:41 -07:00

31 lines
1.2 KiB
Text

# No args is an error
argparse: No option specs were provided
# Missing -- is an error
argparse: Missing -- separator
# Flags but no option specs is an error
argparse: No option specs were provided
# Invalid option specs
argparse: Invalid option spec 'h-' at char '-'
argparse: Short flag '+' invalid, must be alphanum or '#'
argparse: Invalid option spec 'h/help:' at char ':'
argparse: Invalid option spec 'h-help::' at char ':'
argparse: Invalid option spec 'h-help=x' at char 'x'
# --max-args and --min-args work
min-max: Expected at least 1 args, got only 0
min-max: Expected at most 3 args, got 4
min-max: Expected at most 1 args, got 2
# Invalid "#-val" spec
argparse: Implicit int short flag '#' does not allow modifiers like '='
# Invalid arg in the face of a "#-val" spec
argparse: Unknown option '-x'
Standard input (line 38):
argparse '#-val' -- abc -x def
^
# Defining a short flag more than once
argparse: Short flag 's' already defined
# Defining a long flag more than once
argparse: Long flag 'short' already defined
# Defining an implicit int flag more than once
argparse: Implicit int flag '#' already defined
# Defining an implicit int flag with modifiers
argparse: Implicit int short flag 'v' does not allow modifiers like '='