-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
Multiple commands sharing the same positional arguments #408
Comments
No that's not possible. What would that look like in practice? |
Here is the actual code And in usage it look like I guess that's pretty specific, so I understand I can't just do a simple CLI.Paths, but I wonder if there could be a trick by putting "Paths" in its own structure and somehow sharing it between subcommand That's what I would avoid if possible
|
For the record: not sure if that's a better solution, though it's possible to use
|
Hi
Asking because my workaround now brings me too many issues
I currently have
"Paths" is a required arguments shared by almost all subcommands
I have tried but never succeeded in putting Paths under "CLI", instead of duplicating it on every subcommand.
It would always give
panic: can't mix positional arguments and branching arguments on *struct
Is there a solution to put "Paths" under CLI somehow, so that I don't have to do
CLI.List.Paths
orCLI.Ctx.Path
, but instead do something more generic likeCLI.Paths
?Maybe the only subcommands not using
Paths
could be a blocker ?Any pointer would be greatly appreciated!
Excellent library btw, simple and effective
The text was updated successfully, but these errors were encountered: