]> git.lizzy.rs Git - micro.git/commitdiff
remove carriage return from -clean prompt and fix broken logic (#2186)
authorAndrew Clarke <mail@ozzmosis.com>
Sat, 21 Aug 2021 04:30:16 +0000 (14:30 +1000)
committerGitHub <noreply@github.com>
Sat, 21 Aug 2021 04:30:16 +0000 (00:30 -0400)
cmd/micro/clean.go

index 6ec5455f5ae303ea740c5ce5968c60935a42e9aa..7dfd2c7a2b50eb3d7a593eb22c6994f4b82f6bb1 100644 (file)
@@ -23,12 +23,9 @@ func shouldContinue() bool {
                return false
        }
 
-       if len(text) <= 1 {
-               // default continue
-               return true
-       }
+    text = strings.TrimRight(text, "\r\n")
 
-       return strings.ToLower(text)[0] == 'y'
+       return len(text) == 0 || strings.ToLower(text)[0] == 'y'
 }
 
 // CleanConfig performs cleanup in the user's configuration directory