2017-07-13 05:12:41 +00:00
|
|
|
# No args
|
|
|
|
# One arg and no matching flags
|
|
|
|
argv help
|
|
|
|
# Five args with two matching a flag
|
2017-07-21 00:54:06 +00:00
|
|
|
_flag_h '--help' '-h'
|
|
|
|
_flag_help '--help' '-h'
|
2017-07-13 05:12:41 +00:00
|
|
|
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'
|
2017-07-21 00:54:06 +00:00
|
|
|
_flag_h --help
|
|
|
|
_flag_help --help
|
2017-07-13 05:12:41 +00:00
|
|
|
argv 'help' 'me'
|
|
|
|
# --stop-nonopt works
|
|
|
|
_flag_a A2
|
|
|
|
_flag_abc A2
|
2017-07-21 00:54:06 +00:00
|
|
|
_flag_h -h
|
|
|
|
_flag_help -h
|
2017-07-13 05:12:41 +00:00
|
|
|
argv 'non-opt' 'second non-opt' '--help'
|
2017-07-17 01:27:41 +00:00
|
|
|
# Implicit int flags work
|
2017-07-14 03:36:59 +00:00
|
|
|
_flag_val 123
|
|
|
|
argv 'abc' 'def'
|
|
|
|
_flag_t woohoo
|
|
|
|
_flag_token woohoo
|
2017-07-21 00:54:06 +00:00
|
|
|
_flag_v '-v' '--verbose'
|
2017-07-14 03:36:59 +00:00
|
|
|
_flag_val -234
|
2017-07-21 00:54:06 +00:00
|
|
|
_flag_verbose '-v' '--verbose'
|
2017-07-14 03:36:59 +00:00
|
|
|
argv 'a1' 'a2'
|
2017-07-17 01:27:41 +00:00
|
|
|
# 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'
|
2017-07-17 04:10:22 +00:00
|
|
|
# Check the exit status from argparse validation
|
|
|
|
_flag_name max
|
|
|
|
_flag_value 83
|
|
|
|
expected argparse return status 57
|