示例#1
0
文件: fospc.go 项目: geoah/go-fosp
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
		}
	}
}
示例#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
		}
	}
}