summaryrefslogtreecommitdiff
path: root/src/networking.c
diff options
context:
space:
mode:
authorItamar Haber <itamar@redislabs.com>2018-06-07 18:34:58 +0300
committerItamar Haber <itamar@redislabs.com>2018-06-07 18:34:58 +0300
commit76ad23d012f194efa1acc0f8356d945b07681851 (patch)
treefa483af47218a6011dc78e2415e10eda46ce2e19 /src/networking.c
parentf847dd3ad8aac54f1f5b2919da3b27155926d343 (diff)
downloadredis-76ad23d012f194efa1acc0f8356d945b07681851.tar.gz
Adds MODULE HELP and implements addReplySubSyntaxError
Diffstat (limited to 'src/networking.c')
-rw-r--r--src/networking.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/networking.c b/src/networking.c
index 00558974e..ac28ba2b8 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -560,6 +560,18 @@ void addReplyHelp(client *c, const char **help) {
setDeferredMultiBulkLength(c,blenp,blen);
}
+/* Add a suggestive error reply.
+ * This function is typically invoked by from commands that support
+ * subcommands in response to an unknown subcommand or argument error. */
+void addReplySubSyntaxError(client *c) {
+ sds cmd = sdsnew((char*) c->argv[0]->ptr);
+ sdstoupper(cmd);
+ addReplyErrorFormat(c,
+ "Unknown subcommand or wrong number of arguments for '%s'. Try %s HELP.",
+ c->argv[1]->ptr,cmd);
+ sdsfree(cmd);
+}
+
/* Copy 'src' client output buffers into 'dst' client output buffers.
* The function takes care of freeing the old output buffers of the
* destination client. */