-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Accessing parent options from subcommand #243
Comments
That's not the best idea, subcommands should behave like independent programs. |
Thanks for the tip! |
Let me know if it works :) |
It did :) I just create a basic commander object with the common options inside a function that returns it and use that function to initialize each of the commander objects I need, so they're all already populated with the common options. Thanks! |
hi @marc0s, can you share some code or example of how you did? just for the records, thankx |
@b4dnewz I did it like this
and
|
Opened poll on possible enhancements to global options: #1551 |
Opened a draft PR for |
Are parent's options available to subcommands? In my tests, they aren't.
It would be nice to have them available. In my case is for configuring the remote server my CLI app needs to connect to, so I have not to define the same options in every subcommand.
And if you run them:
Any trick to get them from the subcommand or is just not possible?
Thanks.
The text was updated successfully, but these errors were encountered: