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
8079656a
Commit
8079656a
authored
Aug 30, 2010
by
antirez
Browse files
Now redis-cli replies to help showing some basic usage information (Issue 291)
parent
93b2a771
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
8079656a
...
@@ -251,12 +251,32 @@ static int selectDb(int fd) {
...
@@ -251,12 +251,32 @@ static int selectDb(int fd) {
return
0
;
return
0
;
}
}
static
void
showInteractiveHelp
(
void
)
{
printf
(
"
\n
"
"Welcome to redis-cli "
REDIS_VERSION
"!
\n
"
"Just type any valid Redis command to see a pretty printed output.
\n
"
"
\n
"
"It is possible to quote strings, like in:
\n
"
" set
\"
my key
\"
\"
some string
\\
xff
\\
n
\"\n
"
"
\n
"
"You can find a list of valid Redis commands at
\n
"
" http://code.google.com/p/redis/wiki/CommandReference
\n
"
"
\n
"
"Note: redis-cli supports line editing, use up/down arrows for history."
"
\n\n
"
);
}
static
int
cliSendCommand
(
int
argc
,
char
**
argv
,
int
repeat
)
{
static
int
cliSendCommand
(
int
argc
,
char
**
argv
,
int
repeat
)
{
char
*
command
=
argv
[
0
];
char
*
command
=
argv
[
0
];
int
fd
,
j
,
retval
=
0
;
int
fd
,
j
,
retval
=
0
;
sds
cmd
;
sds
cmd
;
config
.
raw_output
=
!
strcasecmp
(
command
,
"info"
);
config
.
raw_output
=
!
strcasecmp
(
command
,
"info"
);
if
(
!
strcasecmp
(
command
,
"help"
))
{
showInteractiveHelp
();
return
0
;
}
if
(
!
strcasecmp
(
command
,
"shutdown"
))
config
.
shutdown
=
1
;
if
(
!
strcasecmp
(
command
,
"shutdown"
))
config
.
shutdown
=
1
;
if
(
!
strcasecmp
(
command
,
"monitor"
))
config
.
monitor_mode
=
1
;
if
(
!
strcasecmp
(
command
,
"monitor"
))
config
.
monitor_mode
=
1
;
if
(
!
strcasecmp
(
command
,
"subscribe"
)
||
if
(
!
strcasecmp
(
command
,
"subscribe"
)
||
...
...
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