mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Change indentation and other minor details of PR #4489.
The main change introduced by this commit is pretending that help arrays are more text than code, thus indenting them at level 0. This improves readability, and is an old practice when defining arrays of C strings describing text. Additionally a few useless return statements are removed, and the HELP subcommand capitalized when printed to the user.
This commit is contained in:
parent
482d678e95
commit
522760fac7
@ -4285,7 +4285,7 @@ void clusterCommand(client *c) {
|
|||||||
clusterAddSlot(n,slot);
|
clusterAddSlot(n,slot);
|
||||||
} else {
|
} else {
|
||||||
addReplyError(c,
|
addReplyError(c,
|
||||||
"Invalid CLUSTER SETSLOT action or number of arguments. Try CLUSTER help");
|
"Invalid CLUSTER SETSLOT action or number of arguments. Try CLUSTER HELP");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|CLUSTER_TODO_UPDATE_STATE);
|
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|CLUSTER_TODO_UPDATE_STATE);
|
||||||
@ -4635,7 +4635,7 @@ void clusterCommand(client *c) {
|
|||||||
clusterReset(hard);
|
clusterReset(hard);
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try CLUSTER help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try CLUSTER HELP",
|
||||||
(char*)c->argv[1]->ptr);
|
(char*)c->argv[1]->ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2099,7 +2099,7 @@ void configCommand(client *c) {
|
|||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try SLOWLOG help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try CONFIG HELP",
|
||||||
(char*)c->argv[1]->ptr);
|
(char*)c->argv[1]->ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ void debugCommand(client *c) {
|
|||||||
clearReplicationId2();
|
clearReplicationId2();
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try DEBUG help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try DEBUG HELP",
|
||||||
(char*)c->argv[1]->ptr);
|
(char*)c->argv[1]->ptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ void addReplyBulkSds(client *c, sds s) {
|
|||||||
addReply(c,shared.crlf);
|
addReply(c,shared.crlf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a C nul term string as bulk reply */
|
/* Add a C null term string as bulk reply */
|
||||||
void addReplyBulkCString(client *c, const char *s) {
|
void addReplyBulkCString(client *c, const char *s) {
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
addReply(c,shared.nullbulk);
|
addReply(c,shared.nullbulk);
|
||||||
@ -596,7 +596,7 @@ void addReplyBulkLongLong(client *c, long long ll) {
|
|||||||
addReplyBulkCBuffer(c,buf,len);
|
addReplyBulkCBuffer(c,buf,len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add an array of strings as a bulk reply with a heading.
|
/* Add an array of C strings as status replies with a heading.
|
||||||
* This function is typically invoked by from commands that support
|
* This function is typically invoked by from commands that support
|
||||||
* subcommands in response to the 'help' subcommand. The help array
|
* subcommands in response to the 'help' subcommand. The help array
|
||||||
* is terminated by NULL sentinel. */
|
* is terminated by NULL sentinel. */
|
||||||
@ -1750,9 +1750,8 @@ void clientCommand(client *c) {
|
|||||||
pauseClients(duration);
|
pauseClients(duration);
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try CLIENT help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try CLIENT HELP", (char*)c->argv[1]->ptr);
|
||||||
(char*)c->argv[1]->ptr);
|
}
|
||||||
return; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This callback is bound to POST and "Host:" command names. Those are not
|
/* This callback is bound to POST and "Host:" command names. Those are not
|
||||||
|
@ -1109,9 +1109,7 @@ void objectCommand(client *c) {
|
|||||||
* when the key is read or overwritten. */
|
* when the key is read or overwritten. */
|
||||||
addReplyLongLong(c,LFUDecrAndReturn(o));
|
addReplyLongLong(c,LFUDecrAndReturn(o));
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try OBJECT help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try OBJECT help", (char *)c->argv[1]->ptr);
|
||||||
(char *)c->argv[1]->ptr);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,8 +372,7 @@ void pubsubCommand(client *c) {
|
|||||||
/* PUBSUB NUMPAT */
|
/* PUBSUB NUMPAT */
|
||||||
addReplyLongLong(c,listLength(server.pubsub_patterns));
|
addReplyLongLong(c,listLength(server.pubsub_patterns));
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try PUBSUB help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try PUBSUB HELP",
|
||||||
(char*)c->argv[1]->ptr);
|
(char*)c->argv[1]->ptr);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1458,10 +1458,10 @@ void scriptCommand(client *c) {
|
|||||||
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
|
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
|
||||||
const char *help[] = {
|
const char *help[] = {
|
||||||
"debug (yes|sync|no) -- Set the debug mode for subsequent scripts executed.",
|
"debug (yes|sync|no) -- Set the debug mode for subsequent scripts executed.",
|
||||||
"exists sha1 [sha1 ...] -- Return information about the existence of the scripts in the script cache.",
|
"exists <sha1> [<sha1> ...] -- Return information about the existence of the scripts in the script cache.",
|
||||||
"flush -- Flush the Lua scripts cache.",
|
"flush -- Flush the Lua scripts cache. Very dangerous on slaves.",
|
||||||
"kill -- Kill the currently executing Lua script.",
|
"kill -- Kill the currently executing Lua script.",
|
||||||
"load script -- Load a script into the scripts cache, without executing it.",
|
"load <script> -- Load a script into the scripts cache, without executing it.",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
addReplyHelp(c, help);
|
addReplyHelp(c, help);
|
||||||
@ -1514,9 +1514,7 @@ void scriptCommand(client *c) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try SCRIPT help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try SCRIPT HELP", (char*)c->argv[1]->ptr);
|
||||||
(char*)c->argv[1]->ptr);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2810,9 +2810,7 @@ void commandCommand(client *c) {
|
|||||||
for (j = 0; j < numkeys; j++) addReplyBulk(c,c->argv[keys[j]+2]);
|
for (j = 0; j < numkeys; j++) addReplyBulk(c,c->argv[keys[j]+2]);
|
||||||
getKeysFreeResult(keys);
|
getKeysFreeResult(keys);
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try COMMAND help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try COMMAND HELP", (char*)c->argv[1]->ptr);
|
||||||
(char*)c->argv[1]->ptr);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,8 @@ void slowlogReset(void) {
|
|||||||
void slowlogCommand(client *c) {
|
void slowlogCommand(client *c) {
|
||||||
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
|
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
|
||||||
const char *help[] = {
|
const char *help[] = {
|
||||||
"get [count] -- Return top entries from the slowlog (default: 10). Entries are made of:",
|
"get [count] -- Return top entries from the slowlog (default: 10)."
|
||||||
|
" Entries are made of:",
|
||||||
" id, timestamp, time in microseconds, arguments array, client IP and port, client name",
|
" id, timestamp, time in microseconds, arguments array, client IP and port, client name",
|
||||||
"len -- Return the length of the slowlog.",
|
"len -- Return the length of the slowlog.",
|
||||||
"reset -- Reset the slowlog.",
|
"reset -- Reset the slowlog.",
|
||||||
@ -186,8 +187,6 @@ void slowlogCommand(client *c) {
|
|||||||
}
|
}
|
||||||
setDeferredMultiBulkLength(c,totentries,sent);
|
setDeferredMultiBulkLength(c,totentries,sent);
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try SLOWLOG help",
|
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try SLOWLOG HELP", (char*)c->argv[1]->ptr);
|
||||||
(char*)c->argv[1]->ptr);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user