feat: exit on EOF (^D/ctrl d)

pull/5/head
TorchedSammy 2021-03-20 12:57:18 -04:00
parent 7ac391e3b1
commit 4456d7593b
1 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import (
"syscall"
"os/signal"
"strings"
"io"
"github.com/akamensky/argparse"
"github.com/bobappleyard/readline"
@ -51,6 +52,10 @@ func main() {
//fmt.Printf(prompt)
cmdString, err := readline.String(prompt)
if err == io.EOF {
fmt.Println("")
break
}
if err != nil {
fmt.Fprintln(os.Stderr, err)
}