Python argparse: Display parse_known_args mode in usage string

Viewed 2442

When using Python's argparse module you can use parse_known_args() to parse only arguments that are known to the parser and any additional arguments are returned separately.

However, this fact is not denoted in the usage/help string. Of course I could put it in the description field of the parser, but I wonder if there's a nice way to include it in the usage line.

What I'm looking for is an output of e.g. usage: test [-h] ... instead of usage: test [-h]

2 Answers
Related