diff --git a/commands/exit.go b/commands/exit.go index 653091c..d47131d 100644 --- a/commands/exit.go +++ b/commands/exit.go @@ -34,7 +34,7 @@ func exitCtrlD() { text, _ := reader.ReadString('\n') answer := strings.TrimSpace(text) - if (answer == "Y") || (answer == "y") { + if strings.EqualFold(answer, "y") { os.Exit(0) } } diff --git a/commands/shell.go b/commands/shell.go index 4132e52..6b25c93 100644 --- a/commands/shell.go +++ b/commands/shell.go @@ -17,10 +17,13 @@ func ExecuteShell() *cobra.Command { Short: "Execute the remaining arguments with system shell", DisableFlagParsing: true, RunE: func(_ *cobra.Command, args []string) error { - if len(args) == 0 { + // Only at least one argument is needed, since the command + // itself is stripped before those args are passed as an array. + if len(args) < 1 { return errors.New("command requires one or more arguments") } + // Above, the length of args is checked to be at least 2 path, err := exec.LookPath(args[0]) if err != nil { return err