From 74c7c6bfa50fd3f65af28038606a7cdf8034e0ab Mon Sep 17 00:00:00 2001 From: Tim Lebel Date: Tue, 2 Jun 2015 22:18:36 -0700 Subject: [PATCH 1/2] Fixes #261 -- Quit repl when user types "exit" --- db/repl.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/repl.go b/db/repl.go index 00acd63..9183654 100644 --- a/db/repl.go +++ b/db/repl.go @@ -160,6 +160,10 @@ func Repl(h *graph.Handle, queryLanguage string, cfg *config.Config) error { h.QuadWriter.RemoveQuad(quad) continue + case "exit": + term.Close() + os.Exit(0) + default: if cmd[0] == ':' { fmt.Printf("Unknown command: %q\n", cmd) From 43b3610dc19a7286929202404009516780df41b9 Mon Sep 17 00:00:00 2001 From: Tim Lebel Date: Tue, 2 Jun 2015 23:17:02 -0700 Subject: [PATCH 2/2] No plural when only one result --- db/repl.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/repl.go b/db/repl.go index 9183654..9af2a6f 100644 --- a/db/repl.go +++ b/db/repl.go @@ -60,7 +60,11 @@ func Run(query string, ses query.Session) { nResults++ } if nResults > 0 { - fmt.Printf("-----------\n%d Results\n", nResults) + results := "Result" + if nResults > 1 { + results += "s" + } + fmt.Printf("-----------\n%d %s\n", nResults, results) } }