summaryrefslogtreecommitdiff
path: root/cmd/dolmetschctld/telnet.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-02-10 22:19:10 +0100
committerChristian Pointner <equinox@spreadspace.org>2019-02-10 22:19:10 +0100
commitd4513abfcc27e8b7cf4f54f3513cdb865e2dcc76 (patch)
treeeed519ee0bff78220099bb56334ae45cc788c4d0 /cmd/dolmetschctld/telnet.go
parentadded getter for ratio and lang (diff)
added function to get state
Diffstat (limited to 'cmd/dolmetschctld/telnet.go')
-rw-r--r--cmd/dolmetschctld/telnet.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/dolmetschctld/telnet.go b/cmd/dolmetschctld/telnet.go
index 901c226..d6a5c4a 100644
--- a/cmd/dolmetschctld/telnet.go
+++ b/cmd/dolmetschctld/telnet.go
@@ -74,6 +74,15 @@ func telnetCmdRatio(c *telgo.Client, args []string, sm *StateMachine) bool {
return false
}
+func telnetCmdState(c *telgo.Client, args []string, sm *StateMachine) bool {
+ if len(args) != 1 {
+ c.Sayln("usage: state")
+ return false
+ }
+ c.Sayln("current state: %s", sm.GetState())
+ return false
+}
+
func telnetQuit(c *telgo.Client, args []string) bool {
return true
}
@@ -88,6 +97,7 @@ func NewTelnetInterface(addr string, sm *StateMachine) (telnet *TelnetInterface,
cmdlist := make(telgo.CmdList)
cmdlist["lang"] = func(c *telgo.Client, args []string) bool { return telnetCmdLang(c, args, sm) }
cmdlist["ratio"] = func(c *telgo.Client, args []string) bool { return telnetCmdRatio(c, args, sm) }
+ cmdlist["state"] = func(c *telgo.Client, args []string) bool { return telnetCmdState(c, args, sm) }
cmdlist["quit"] = telnetQuit
telnet.server, err = telgo.NewServer(addr, "dolmetschctl> ", cmdlist, nil)