mirror of https://github.com/Hilbis/Hilbish
feat: exit on EOF (^D/ctrl d)
parent
7ac391e3b1
commit
4456d7593b
5
main.go
5
main.go
|
@ -9,6 +9,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strings"
|
"strings"
|
||||||
|
"io"
|
||||||
|
|
||||||
"github.com/akamensky/argparse"
|
"github.com/akamensky/argparse"
|
||||||
"github.com/bobappleyard/readline"
|
"github.com/bobappleyard/readline"
|
||||||
|
@ -51,6 +52,10 @@ func main() {
|
||||||
//fmt.Printf(prompt)
|
//fmt.Printf(prompt)
|
||||||
|
|
||||||
cmdString, err := readline.String(prompt)
|
cmdString, err := readline.String(prompt)
|
||||||
|
if err == io.EOF {
|
||||||
|
fmt.Println("")
|
||||||
|
break
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue