-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Support subcommands with arguments #1
Comments
I suppose |
Hi Naji, Thanks for raising the issue. I have a few questions on what you'd expect here. Let's say a command uses a structure that has sub and sub-sub commands: command = Lino::CommandLineBuilder
.for_command('x')
.with_subcommand('y')
.with_subcommand('z') Today this produces command = Lino::CommandLineBuilder
.for_command('x')
.with_subcommand('y') do |y|
y.with_argument('a')
end
.with_subcommand('z') do |z|
z.with_argument('b')
end What would you expect the command to end up as? There's then a risk of misinterpreting arguments as subcommands and vice versa. It's for this reason that most commands expect or at least allow all arguments to come last after flags and options. And it's based on this that arguments is considered a top level method rather than a subcommand method. Let me know your thoughts, Thanks, |
Hi Toby, Thanks for the prompt reply! That's fair; I hadn't considered that ambiguity. FWIW, I would expect But I do see the drawbacks, and the command I'm trying to use does indeed allow arguments to come last, so I'll close this out! Thanks! |
Currently,
results in
Would it be possible to add support for
with_argument
inSubcommandBuilder
?The text was updated successfully, but these errors were encountered: