Browse Source

add help command

master 0.0.1
Brett Langdon 13 years ago
parent
commit
5834553dda
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      commands/commands.go

+ 15
- 0
commands/commands.go View File

@ -42,6 +42,9 @@ func HandleCommand(command string, tokens []string, db *cabinet.KCDB) string {
case "version":
result = HandleVersion()
break
case "help":
result = HandleHelp()
break
default:
result = "ERROR\r\n"
break
@ -155,3 +158,15 @@ func HandleDelete(tokens []string, db *cabinet.KCDB) string {
func HandleVersion() string {
return fmt.Sprintf("VERSION %s\r\n", common.VERSION)
}
func HandleHelp() string {
return "COMMAND GET <KEY> - retrieve <KEY> from the cache\r\n" +
"COMMAND FLUSH_ALL - remove all records from the cache\r\n" +
"COMMAND DELETE <KEY> - remove <KEY> from the cache\r\n" +
"COMMAND VERSION - display the application version\r\n" +
"COMMAND STATS - display application statistics\r\n" +
"COMMAND QUIT - close the connection\r\n" +
"COMMAND EXIT - same as QUIT\r\n" +
"COMMAND HELP - display this information\r\n" +
"END\r\n"
}

Loading…
Cancel
Save