diff --git a/commands/commands.go b/commands/commands.go index a1371c4..d8fb6a9 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -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 - retrieve from the cache\r\n" + + "COMMAND FLUSH_ALL - remove all records from the cache\r\n" + + "COMMAND DELETE - remove 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" +}