Skip to content

Commit

Permalink
Merge pull request #5 from gaurav-gogia/dev
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
gaurav-gogia authored Jun 26, 2022
2 parents 3b6b419 + 6831a45 commit 598b1ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 1 addition & 4 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ func RunRepl() {
signal.Notify(c, os.Interrupt)
go func() {
<-c
fmt.Printf("\n\n")
fmt.Println("---- Leaving for a byte? I'll see you later! ----")
fmt.Printf("\n\n")
os.Exit(0)
repl.GracefulExit()
}()
repl.Start(os.Stdin, os.Stdout)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module mutant

go 1.16
go 1.18
13 changes: 12 additions & 1 deletion repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func Start(in io.Reader, out io.Writer) {
}

func welcome() {
fmt.Println(banner)
fmt.Print(banner)

user, err := user.Current()
if err != nil {
Expand Down Expand Up @@ -132,5 +132,16 @@ func vanity(line string, out io.Writer) bool {
return true
}

if line == "exit" {
GracefulExit()
}

return false
}

func GracefulExit() {
fmt.Printf("\n\n")
fmt.Println("---- Leaving for a byte? I'll see you later! ----")
fmt.Printf("\n\n")
os.Exit(0)
}

0 comments on commit 598b1ae

Please sign in to comment.