Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
51eb6cb3
Commit
51eb6cb3
authored
Dec 03, 2017
by
Itamar Haber
Browse files
Adds help to `CONFIG`
parent
bd5af03d
Changes
1
Show whitespace changes
Inline
Side-by-side
src/config.c
View file @
51eb6cb3
...
@@ -2065,19 +2065,24 @@ void configCommand(client *c) {
...
@@ -2065,19 +2065,24 @@ void configCommand(client *c) {
return;
return;
}
}
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"set"
))
{
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
if
(
c
->
argc
!=
4
)
goto
badarity
;
const char *help[] = {
"get <pattern> -- Return parameters matching the glob-like <pattern> and their values.",
"set <parameter> <value> -- Set parameter to value.",
"resetstat -- Reset statistics reported by INFO.",
"rewrite -- Rewrite the configuration file.",
NULL
};
addReplyHelp(c, help);
} else if (!strcasecmp(c->argv[1]->ptr,"set") && c->argc == 4) {
configSetCommand(c);
configSetCommand(c);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"get"
))
{
} else if (!strcasecmp(c->argv[1]->ptr,"get") && c->argc == 3) {
if
(
c
->
argc
!=
3
)
goto
badarity
;
configGetCommand(c);
configGetCommand(c);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"resetstat"
))
{
} else if (!strcasecmp(c->argv[1]->ptr,"resetstat") && c->argc == 2) {
if
(
c
->
argc
!=
2
)
goto
badarity
;
resetServerStats();
resetServerStats();
resetCommandTableStats();
resetCommandTableStats();
addReply(c,shared.ok);
addReply(c,shared.ok);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"rewrite"
))
{
} else if (!strcasecmp(c->argv[1]->ptr,"rewrite") && c->argc == 2) {
if
(
c
->
argc
!=
2
)
goto
badarity
;
if (server.configfile == NULL) {
if (server.configfile == NULL) {
addReplyError(c,"The server is running without a config file");
addReplyError(c,"The server is running without a config file");
return;
return;
...
@@ -2090,12 +2095,8 @@ void configCommand(client *c) {
...
@@ -2090,12 +2095,8 @@ void configCommand(client *c) {
addReply(c,shared.ok);
addReply(c,shared.ok);
}
}
} else {
} else {
addReplyError
(
c
,
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try SLOWLOG help",
"CONFIG subcommand must be one of GET, SET, RESETSTAT, REWRITE"
);
(char*)c->argv[1]->ptr);
}
return;
return;
}
badarity:
addReplyErrorFormat
(
c
,
"Wrong number of arguments for CONFIG %s"
,
(
char
*
)
c
->
argv
[
1
]
->
ptr
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment