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

Case-insensitive command #28

Closed
vleonov opened this issue Aug 8, 2017 · 2 comments · Fixed by #37
Closed

Case-insensitive command #28

vleonov opened this issue Aug 8, 2017 · 2 comments · Fixed by #37

Comments

@vleonov
Copy link

vleonov commented Aug 8, 2017

Current implemenation of Command is case-sensitive. E.g. if I register a command help, I should send exact command help, but not Help or HELP. It's unusual.

So, why don't make it case-insensitive by adding modifier i inside getCommand method?

This
$find = '/^'.preg_quote($commandName).'/';
Change to this
$find = '/^'.preg_quote($commandName).'/i';

@jclg
Copy link
Owner

jclg commented Aug 25, 2017

I don't think it's unusual but maybe we can make it optional.
Inside the configure() method for a given command, we can set this option.
By default, it's still case-sensitive.

    protected function configure() {
        $this->setName('help');
        $this->setCaseInsensitive(true); // Now it works with help, Help and HELP
    }

What do you think ?

@vleonov
Copy link
Author

vleonov commented Aug 25, 2017

Well, why not? This solution would work fine.

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

Successfully merging a pull request may close this issue.

2 participants