-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add support for case-insensitive command names #1382
Comments
This issue is being marked as stale due to a long period of inactivity |
Is this issue planned on being addressed to anytime soon in any of the subsequent releases ? |
Seems like a pretty straightforward, reasonable request to me. I'm currently focused on backlog cleanup but I think if you put up the PR I could find time to review it. To be backwards compatible we just need to gate the behavior with a corresponding option. |
Hi, I would want to help with this one. Is it still a desired enhancement? is anyone already working on it? |
I'd like to see something like this. Let's go for it @trilopin, I can help if you need |
Would love to see this feature! If still open, I would offer to help out? |
Add a global `EnableCaseInsensitive` variable to allow case-insensitive command names. The variable supports commands names and aliases globally. Resolves spf13#1382
Add a global `EnableCaseInsensitive` variable to allow case-insensitive command names. The variable supports commands names and aliases globally. Resolves spf13#1382
Add a global `EnableCaseInsensitive` variable to allow case-insensitive command names. The variable supports commands names and aliases globally. Resolves spf13#1382
Add a global `EnableCaseInsensitive` variable to allow case-insensitive command names. The variable supports commands names and aliases globally. Resolves spf13#1382
Add a global `EnableCaseInsensitive` variable to allow case-insensitive command names. The variable supports commands names and aliases globally. Resolves #1382
Right now users decide on supported command name using
Command::Use
andCommand::Aliases
. There is no way to tell Cobra to use case-insensitive name matching.Cobra has
SetGlobalNormalizationFunc
which can be used to achieve case-insensitive flag name matching but there is no such option for command names. Generating aliases with all possible spellings isn't an option because users would need to have a list of aliases that is2**len(commandName)
characters long. Users aren't able to customize theCommand::Find
behavior becauseCommand::AddCommand
function takes astruct
and not aninterface
.@jpmcb @jharshman @marckhouzam are maintainers open to accepting a PR that adds functionality which allows users to create commands with case-insensitive command name matching?
Example
Imagine I'm writing a CLI program like
kubectl
. I want to haveget
subcommand and haveservice
(aliases:svc
,svcs
) anddeployment
(aliases:deployments
) subcommands ofget
subcommand. The sub-subcommand names should be case-insensitive similarly to like how you can dokubectl get sErvICeS
.kubectl
opted to have no subcommands afterget
and instead takes the type of resource as first argument. If I wanted to have a case-insensitiveservice
sub-subcommand there is currently no supported way to achieve that.The text was updated successfully, but these errors were encountered: