Esempio n. 1
0
func loop() {
	for {
		switch result := readline.ReadLine(&prompt); true {
		case result == nil:
			println()
			return
		case *result != "": //ignore blank lines
			parseCommand(*result)
			readline.AddHistory(*result) //allow user to recall this line
		}
	}
}
Esempio n. 2
0
func main() {
	prompt := "> "
	//loop until ReadLine returns nil (signalling EOF)
L:
	for {
		switch result := readline.ReadLine(&prompt); true {
		case result == nil:
			println()
			break L //exit loop
		case *result != "": //ignore blank lines
			println(*result)
			readline.AddHistory(*result) //allow user to recall this line
		}
	}
}