Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
f18e059e
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f18e059e
编写于
12月 15, 2010
作者:
P
Pieter Noordhuis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make redis-cli help a little better
上级
c392edf5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
19 deletion
+31
-19
src/redis-cli.c
src/redis-cli.c
+31
-19
未找到文件。
src/redis-cli.c
浏览文件 @
f18e059e
...
...
@@ -475,6 +475,8 @@ static int parseOptions(int argc, char **argv) {
i
++
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-h"
)
&&
lastarg
)
{
usage
();
}
else
if
(
!
strcmp
(
argv
[
i
],
"--help"
))
{
usage
();
}
else
if
(
!
strcmp
(
argv
[
i
],
"-x"
))
{
config
.
stdinarg
=
1
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-p"
)
&&
!
lastarg
)
{
...
...
@@ -492,19 +494,10 @@ static int parseOptions(int argc, char **argv) {
}
else
if
(
!
strcmp
(
argv
[
i
],
"-a"
)
&&
!
lastarg
)
{
config
.
auth
=
argv
[
i
+
1
];
i
++
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-i"
))
{
fprintf
(
stderr
,
"Starting interactive mode using -i is deprecated. Interactive mode is started
\n
"
"by default when redis-cli is executed without a command to execute.
\n
"
);
}
else
if
(
!
strcmp
(
argv
[
i
],
"-c"
))
{
fprintf
(
stderr
,
"Reading last argument from standard input using -c is deprecated.
\n
"
"When standard input is connected to a pipe or regular file, it is
\n
"
"automatically used as last argument.
\n
"
);
}
else
if
(
!
strcmp
(
argv
[
i
],
"-v"
))
{
printf
(
"redis-cli shipped with Redis version %s (%s)
\n
"
,
REDIS_VERSION
,
redisGitSHA1
());
}
else
if
(
!
strcmp
(
argv
[
i
],
"-v"
)
||
!
strcmp
(
argv
[
i
],
"--version"
))
{
sds
version
=
cliVersion
();
printf
(
"redis-cli %s
\n
"
,
version
);
sdsfree
(
version
);
exit
(
0
);
}
else
{
break
;
...
...
@@ -531,12 +524,31 @@ static sds readArgFromStdin(void) {
}
static
void
usage
()
{
fprintf
(
stderr
,
"usage: redis-cli [-iv] [-h host] [-p port] [-s /path/to/socket] [-a authpw] [-r repeat_times] [-n db_num] cmd arg1 arg2 arg3 ... argN
\n
"
);
fprintf
(
stderr
,
"usage: echo
\"
argN
\"
| redis-cli -x [options] cmd arg1 arg2 ... arg(N-1)
\n\n
"
);
fprintf
(
stderr
,
"example: cat /etc/passwd | redis-cli -x set my_passwd
\n
"
);
fprintf
(
stderr
,
"example: redis-cli get my_passwd
\n
"
);
fprintf
(
stderr
,
"example: redis-cli -r 100 lpush mylist x
\n
"
);
fprintf
(
stderr
,
"
\n
Run in interactive mode: redis-cli -i or just don't pass any command
\n
"
);
sds
version
=
cliVersion
();
fprintf
(
stderr
,
"redis-cli %s
\n
"
"
\n
"
"Usage: redis-cli [OPTIONS] [cmd [arg [arg ...]]]
\n
"
" -h <hostname> Server hostname (default: 127.0.0.1)
\n
"
" -p <port> Server port (default: 6379)
\n
"
" -s <socket> Server socket (overrides hostname and port)
\n
"
" -a <password> Password to use when connecting to the server
\n
"
" -r <repeat> Execute specified command N times
\n
"
" -n <db> Database number
\n
"
" -x Read last argument from STDIN
\n
"
" --help Output this help and exit
\n
"
" --version Output version and exit
\n
"
"
\n
"
"Examples:
\n
"
" cat /etc/passwd | redis-cli -x set mypasswd
\n
"
" redis-cli get mypasswd
\n
"
" redis-cli -r 100 lpush mylist x
\n
"
"
\n
"
"When no command is given, redis-cli starts in interactive mode.
\n
"
"Type
\"
help
\"
in interactive mode for information on available commands.
\n
"
"
\n
"
,
version
);
sdsfree
(
version
);
exit
(
1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录