-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Support subcommands in Homebrew::CLI::Parser
#19639
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
Comments
My question is how do we specify flags, switches, named args, etc. for these subcommands? Do we just assume each of the options works with all subcommands? In this case, the implementation is fairly trivial but does not reflect the actual usage (autocomplete would suggest dummy parameters to the user). Or do we allow specifying which subcommands accept the flag/option? I think it is not good either (almost all flags in IMHO, the best solution would be to split the |
Using
No, that's what we have today and would be god to avoid.
That's an option if we don't want to have the minimal code changes for this, sure. We'd likely also want/need to adjust the manpage generation to ensure those commands remain grouped nicely as they are today. |
Hey @MikeMcQuaid, @botantony , I'd to tackle this one. What would be the first step in your opinion please? |
@NeimadTL You're welcome to give it a go but I'm afraid I think:
|
Understood. I'll try to at least understand and if I can't move forward, I'll get into another one (any suggestion another issue you may have will be appreciated). Thank you @MikeMcQuaid. |
If it is alright i would like to take this @MikeMcQuaid / @botantony For implementation i have the following though going forward
|
Given the demand here: we're not going to "assign" it to anyone in particular but we'll happily review a PR from anyone.
I don't think we need a dedicated module for Subcommands unless this otherwise excessively bloats the other modules that need changed. Otherwise: makes sense so far. |
Simplest model is probably something like:
|
Yeh, this makes sense to me @Bo98 👍🏻 The hard bit here won't be splitting out the commands as much as:
|
Verification
brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.Provide a detailed description of the proposed feature
We have
brew bundle
andbrew services
commands that both provide "subcommands" i.e.brew bundle install
,brew bundle exec
, etc.These both have some fairly messy and repetitive argument handling, don't do decent generation of e.g. manpages/completions/etc. and don't handle switches well e.g. those that only apply to one subcommand and not others.
#19638 is an example of a slightly messy workaround for
brew services
that doesn't get e.g.brew services info <tab>
to work nicely.What is the motivation for the feature?
How will the feature be relevant to at least 90% of Homebrew users?
Improved user experience using subcommands
What alternatives to the feature have been considered?
Migrating all subcommands to e.g.
brew bundle-exec
instead ofbrew bundle exec
. This would require some workflow changes for users but would result in less code being needed.The text was updated successfully, but these errors were encountered: