2016-03-30 00:44:33 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2016-03-30 00:51:32 +00:00
|
|
|
"os"
|
2016-03-30 00:44:33 +00:00
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// HandleCommand handles input from the user
|
|
|
|
|
func HandleCommand(input string, view *View) {
|
|
|
|
|
cmd := strings.Split(input, " ")[0]
|
|
|
|
|
args := strings.Split(input, " ")[1:]
|
2016-03-30 00:51:32 +00:00
|
|
|
switch cmd {
|
|
|
|
|
case "set":
|
2016-03-30 00:44:33 +00:00
|
|
|
SetOption(view, args)
|
2016-03-30 00:51:32 +00:00
|
|
|
case "quit":
|
|
|
|
|
if view.CanClose("Quit anyway? ") {
|
|
|
|
|
screen.Fini()
|
|
|
|
|
os.Exit(0)
|
|
|
|
|
}
|
|
|
|
|
case "save":
|
|
|
|
|
view.Save()
|
2016-03-30 00:44:33 +00:00
|
|
|
}
|
|
|
|
|
}
|