Skip to content

Commit

Permalink
fix bug in sudo command
Browse files Browse the repository at this point in the history
  • Loading branch information
isacikgoz committed Sep 12, 2020
1 parent 4ce0197 commit 8fe6966
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cli/confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ func ConfirmCommand(command string) error {
fmt.Print(green.Sprint("? "))

fmt.Print(command)
fmt.Print(" (Y/n) ")
fmt.Print(" [Y/n] ")
s := bufio.NewScanner(os.Stdin)
s.Scan()
if s.Text() == "Y" || s.Text() == "y" || s.Text() == "" {
sudo := false
if s.Text() == "Y!" || s.Text() == "y!" {
sudo = true
}
input := s.Text()
sudo := strings.HasSuffix(input, "!")
if strings.HasPrefix(input, "Y") || strings.HasPrefix(input, "y") || s.Text() == "" {

cmds := strings.Split(strings.TrimSpace(command), "|")
if len(cmds) >= 2 {
return pipeCommands(cmds, sudo)
Expand Down

0 comments on commit 8fe6966

Please sign in to comment.