aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2023-09-29 19:25:42 +0100
committerJoop Kiefte <ikojba@gmail.com>2023-09-29 19:25:42 +0100
commite2d9b8acde4aa61d4294d945ab02a6a23af68fc5 (patch)
tree0ce32a9a08d792c4a66b554c53bdb1b7770959a6
parent05c5f0361e115d7eff52e56160efd40c6edbc98e (diff)
Add little trick to quit when no newline
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index e516627..23e360d 100644
--- a/main.go
+++ b/main.go
@@ -116,7 +116,11 @@ func Readline() string {
// Read a line from stdin
reader := bufio.NewReader(os.Stdin)
text, _ := reader.ReadString('\n')
- return strings.TrimRight(text, "\n")
+ rtext := strings.TrimRight(text, "\n")
+ if text == rtext {
+ return "quit"
+ }
+ return rtext
}
func ExecuteDoltCommand(args ...string) {