felixSchl/neodoc

Failes to parse forward slashes

runarberg opened this issue · 1 comments

I am writing a CLI and am considering hierarchical command structure, such that a top level help would look like…

cli-tool

usage:
    cli-tool <command>
    cli-tool --list

options:
    --list    List available commands

…and a help for a given command foo would look like

cli-tool foo

usage:
    cli-tool foo --list

options:
    --list    List available commands under 'foo'

Say cli-tool --list would yield:

foo/bar
foo/baz

and the help for the foo/bar sub-command looks like:

cli-tool foo/bar

usage:
    cli-tool foo/bar

For the last example I get an error:

Failed to parse specification:
Unexpected input: /bar

Turns out that the parser is only able to accept a very narrow range of ASCII alphanumerical characters plus a dot ., the hyphen - and the underscore _.

Note that in docopt forward slashes / are OK in usage examples.

I have never seen / used a command line utility that uses a "/", so I did not catch it. I don't mind adding this in, but I expect there will be many more such cases. I agree losening this up is a good idea, going from inclusive to an exclusive set of allowed characters.