docopt
docopt copied to clipboard
Default option parsing does not handle tabs
The default value for an option is not assigned if there is a tab in the option description.
A working default value example The above example has a tab in the usage statement but not in the option description.
A broken example The leading tab was copied to the start of the option description, the default value is now not assigned. This also occurs when the tab is in the middle of the line.
Have same issue, wasted couple hours to figure out whats wrong.
I "fixed" my program by adding .expandtabs(4) at the end of __doc__ string, this also fixes issue with text alignment.
I also experienced this and tried hours to track the issue down.
Apparently, you are not allowed to use tabs at all.
See my initial Stackoverflow question and its solution.
EDIT: While from a functional point of view, the arguments are parsed correctly when no tabs are used. But in case the call is wrong, only the "Usage:"-Part of the docstring is printed. The "Options:"-Part is not.
Examples:
1a. Valid call
1b. Invalid call(option part is not printed)