repl: add status,help,host cmds

and don't re-apply task for local commands
This commit is contained in:
Norwin 2022-01-02 06:46:53 +01:00
parent 4e0cc35c26
commit 48f1fce93d
1 changed files with 19 additions and 9 deletions

View File

@ -86,7 +86,7 @@ func RunREPL(f Fluter) {
} }
} }
case "address", "a": case "host", "address", "a":
if len(args) == 1 { if len(args) == 1 {
t.Address = args[0] t.Address = args[0]
} }
@ -131,14 +131,24 @@ func RunREPL(f Fluter) {
} }
} }
// the commands below don't affect the task, so we don't need to apply it to clients -> continue
case "metrics": case "metrics":
f.toggleMetrics() f.toggleMetrics()
printTask = false continue
case "status":
fmt.Println(t)
continue
case "help":
printHelp()
continue
default: default:
printTask = false
fmt.Print("[rán] unknown command. ") fmt.Print("[rán] unknown command. ")
printHelp() printHelp()
continue
} }
if printTask { if printTask {