Closed Tyrrrz closed 5 years ago
I specifically need this option for the Warpdrive SDK so I'm going to implement it.
The main challenge with this is that, unlike options, command arguments are ambiguous, i.e. given myapp foo bar
, you can't tell whether bar
is an argument or part of a longer command name foo bar
.
This can be solved by not discerning between command name/arguments at the time of parsing, instead producing something like IReadOnlyList<string> Route
which contains all arguments leading up to the first option. And then determine which part belongs to command name and which part to arguments at a later stage.
I was thinking of something like adding an overload that specified it's relative order.
<exe> <command> <option1> <option2> <option3>
And make the options have attributes that have 1, 2, and 3, etc..
Given a command line exe foo bar lorem ipsum --apples oranges
can you tell where command name ends and anonymous options start? :)
Closed in favor of more descriptive #26
...aka options that don't have a name.
Allow doing something like
app command <option>
or evenapp command <option> subcommand
. Currently this is not possible because<option>
will be parsed as part of the command name.Also, what do we do in case of conflicts? E.g.
app command <option>
where<option>
matches the name of one of the subcommands.Some inspiration can be drawn here: http://docopt.org/