['abc']
Namespace(file=None, positional_file='abc')
['--file', 'abc']
Namespace(file='abc', positional_file=None)
usage: script [-h] (--file FILE | FILE)
This is an example.
positional arguments:
positional_file specifies a file.
optional arguments:
-h, --help show this help message and exit
--file FILE specifies a file.
usage: script [-h] (--file FILE | FILE)
This is an example.
positional arguments:
positional_file specifies a file.
optional arguments:
-h, --help show this help message and exit
--file FILE specifies a file.
usage: script [-h] (--file FILE | FILE)
This is an example.
positional arguments:
positional_file specifies a file.
optional arguments:
-h, --help show this help message and exit
--file FILE specifies a file.
run with ['abc']
run with ['--file', 'abc']
run with ['--file', 'abc', 'def']
usage: script [-h] (--file FILE | FILE)
script: error: argument positional_file: not allowed with argument --file
run with []
usage: script [-h] (--file FILE | FILE)
script: error: one of the arguments positional_file --file is required
run with ['-h']
run with ['-h', '1']
run with ['--help']