Skip to content
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

Root with positional argument followed by subcommand with args #610

Closed
harpratap opened this issue Jan 10, 2018 · 4 comments
Closed

Root with positional argument followed by subcommand with args #610

harpratap opened this issue Jan 10, 2018 · 4 comments

Comments

@harpratap
Copy link

harpratap commented Jan 10, 2018

This is kind of duplicate of #295 but not exactly. I am looking to have both positional args passed to root and also run subcommand at the same time. Both legacyArgs() and the new Args doesn't seem to let me have this type of syntax. For example, I have 3 environments that have different configs. My root command gets the env as positional arg followed by a subcommand, which is common to all envs but with different configs.
eg. root prod destroy my-python-app where prod is positional arg of root, destroy is a subcommand of root and my-python-app is arg of destroy

Alternative way to do this would be to have flags: root --env prod destroy my-python-app but I don't want to keep it so verbose because env is mandatory anyway.

@elfchief
Copy link

Did you ever find a good way to do this? I'm looking to do much the same thing right now.

@harpratap
Copy link
Author

@elfchief Nope. Still using the alternative way I mentioned in the end using flags.

@github-actions
Copy link

This issue is being marked as stale due to a long period of inactivity

@johnSchnake
Copy link
Collaborator

Due to age and activity I'm going to go ahead and close this.

Just as a point of discussion, I'm not sure that requiring --env makes it too verbose; it also makes it clear what the value means.

I think the core of this is really a duplicate of #726 as well seeing as how you express that you want to invoke root with args while then also executing another command afterwards. You can watch/contribute on that thread if you are interested in pursuing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants