Convert command to lowercase in the command palette (#1432)

mine
R0CKSTAR 2023-03-17 23:37:26 +08:00 committed by GitHub
parent f41c22bce2
commit a516775a81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -114,12 +114,13 @@ func (c *Command) run(cmd, path string, clearStack bool) error {
return nil
}
cmds := strings.Split(cmd, " ")
gvr, v, err := c.viewMetaFor(cmds[0])
command := strings.ToLower(cmds[0])
gvr, v, err := c.viewMetaFor(command)
if err != nil {
return err
}
switch cmds[0] {
switch command {
case "ctx", "context", "contexts":
if len(cmds) == 2 {
return useContext(c.app, cmds[1])
@ -139,7 +140,7 @@ func (c *Command) run(cmd, path string, clearStack bool) error {
if err := c.app.switchNS(ns); err != nil {
return err
}
if !c.alias.Check(cmds[0]) {
if !c.alias.Check(command) {
return fmt.Errorf("`%s` Command not found", cmd)
}
return c.exec(cmd, gvr, c.componentFor(gvr, path, v), clearStack)