Skip to content

Commit

Permalink
Convert command to lowercase in the command palette (derailed#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeahdongcn authored Mar 17, 2023
1 parent 49465a4 commit c972a79
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/view/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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)
Expand Down

0 comments on commit c972a79

Please sign in to comment.