Skip to content

Instantly share code, notes, and snippets.

@pvinis
Created December 7, 2013 11:38
Show Gist options
  • Save pvinis/7840124 to your computer and use it in GitHub Desktop.
Save pvinis/7840124 to your computer and use it in GitHub Desktop.
shell
func (sh *Shell) Loop() {
sc := bufio.NewScanner(os.Stdin)
printPrompt()
for sc.Scan() {
line := sc.Text()
if line == "start" || line == "st" {
sh.startStop <- true
} else if line == "stop" {
sh.startStop <- false
} else if line == "exit" {
sh.done = true
}
if sh.done {
break
}
printPrompt()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment