Skip to content

Commit 3b883c2

Browse files
committed
docs: 新增配置godis说明,修改帮助文档首字母为大写
1 parent 812b716 commit 3b883c2

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
# godis
1+
# 什么是godis
22
- 使用`golang`实现的`redis cli`,二进制文件直接运行,无需任何依赖
33
- 支持安全模式,限制只能运行只读命令
44
- 支持常用`cluster``alone`模式的常用命令
5+
6+
# godis加入环境变量
7+
- 下载release中对应平台的压缩包
8+
- 解压,得到godis可执行文件
9+
-`godis`可执行文件移动到`/usr/local/bin/`目录中(适用于Mac和Linux)
10+
- `Windows`需要把`godis`所在的路径加入到系统的环境变量中
11+
12+
配置好之后,在命令行终端输入`godis`就能直接使用啦~
513
```
614
$ godis
715
A utility redis command line
@@ -11,19 +19,19 @@ Usage:
1119
1220
Available Commands:
1321
config Handle godis configuration
14-
del delete a key
15-
exists assure a key is exists
16-
hcopy copy a hash key
17-
hdel hash key hget
22+
del Delete a key
23+
exists Assure a key is exists
24+
hcopy Copy a hash key
25+
hdel Hash key hdel
1826
help Help about any command
19-
hget hash key hget
20-
hgetall hash key hgetall
21-
hmset add a hash key, auto unpack jsonValue
22-
renamenx rename key, if new_key is exist return fail, else success
23-
sadd add a set key
24-
smembers get set key values
25-
ttl get key ttl
26-
type get key type
27+
hget Hash key hget
28+
hgetall Hash key hgetall
29+
hmset Add a hash key, auto unpack jsonValue
30+
renamenx Rename key, if new_key is exist return fail, else success
31+
sadd Add a set key
32+
smembers Get set key values
33+
ttl Get key ttl
34+
type Get key type
2735
```
2836

2937

cmd/godis/hash.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var hGetAllCmdShort = hGetAllCmd
5858
var hGetAllCmd = &cobra.Command{
5959
Use: "hgetall [key]",
6060
Aliases: []string{"hga"},
61-
Short: "hash key hgetall",
61+
Short: "Hash key hgetall",
6262
Args: cobra.ExactArgs(1),
6363
Run: func(cmd *cobra.Command, args []string) {
6464
result := hGetAll(args[0])
@@ -70,7 +70,7 @@ var hGetCmdShort = hGetCmd
7070
var hGetCmd = &cobra.Command{
7171
Use: "hget [key] [field]",
7272
Aliases: []string{"hg"},
73-
Short: "hash key hget",
73+
Short: "Hash key hget",
7474
Args: cobra.ExactArgs(2),
7575
Run: func(cmd *cobra.Command, args []string) {
7676
result := hGet(args[0], args[1])
@@ -83,7 +83,7 @@ var hDelCmdShort = hDelCmd
8383
var hDelCmd = &cobra.Command{
8484
Use: "hdel [key] [field]",
8585
Aliases: []string{"hd"},
86-
Short: "hash key hget",
86+
Short: "Hash key hdel",
8787
Args: cobra.ExactArgs(2),
8888
Run: func(cmd *cobra.Command, args []string) {
8989
if !isExists(args[0]) {
@@ -98,7 +98,7 @@ var hashCopyCmdShort = hashCopyCmd
9898
var hashCopyCmd = &cobra.Command{
9999
Use: "hcopy [old_key] [new_key]",
100100
Aliases: []string{"hcp"},
101-
Short: "copy a hash key",
101+
Short: "Copy a hash key",
102102
Args: cobra.ExactArgs(2),
103103
Run: func(cmd *cobra.Command, args []string) {
104104
result := hGetAll(args[0])
@@ -120,7 +120,7 @@ var hmsetCmdShort = hmsetCmd
120120
var hmsetCmd = &cobra.Command{
121121
Use: "hmset [key] [jsonValue]",
122122
Aliases: []string{"hms"},
123-
Short: "add a hash key, auto unpack jsonValue",
123+
Short: "Add a hash key, auto unpack jsonValue",
124124
Args: cobra.ExactArgs(2),
125125
Example: `godis hash hmset test_key '{"a":1, "b": "b"}'`,
126126
Run: func(cmd *cobra.Command, args []string) {

cmd/godis/key.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
var deleteCmd = &cobra.Command{
2525
Use: "del [key]",
2626
Aliases: []string{"rm", "delete"},
27-
Short: "delete a key",
27+
Short: "Delete a key",
2828
Args: cobra.ExactArgs(1),
2929
Run: func(cmd *cobra.Command, args []string) {
3030
if !isExists(args[0]) {
@@ -45,7 +45,7 @@ var deleteCmd = &cobra.Command{
4545

4646
var existsCmd = &cobra.Command{
4747
Use: "exists [key]",
48-
Short: "assure a key is exists",
48+
Short: "Assure a key is exists",
4949
Args: cobra.ExactArgs(1),
5050
Run: func(cmd *cobra.Command, args []string) {
5151
if isExists(args[0]) {
@@ -69,7 +69,7 @@ var keysCmd = &cobra.Command{
6969

7070
var typeCmd = &cobra.Command{
7171
Use: "type [key]",
72-
Short: "get key type",
72+
Short: "Get key type",
7373
Args: cobra.ExactArgs(1),
7474
Run: func(cmd *cobra.Command, args []string) {
7575
res := typeKey(args[0])
@@ -78,7 +78,7 @@ var typeCmd = &cobra.Command{
7878
}
7979
var ttlCmd = &cobra.Command{
8080
Use: "ttl [key]",
81-
Short: "get key ttl",
81+
Short: "Get key ttl",
8282
Args: cobra.ExactArgs(1),
8383
Run: func(cmd *cobra.Command, args []string) {
8484
res := ttlKey(args[0])
@@ -88,7 +88,7 @@ var ttlCmd = &cobra.Command{
8888
var renamenxCmd = &cobra.Command{
8989
Use: "renamenx [old_key] [new_key]",
9090
Aliases: []string{"mv"},
91-
Short: "rename key, if new_key is exist return fail, else success",
91+
Short: "Rename key, if new_key is exist return fail, else success",
9292
Args: cobra.ExactArgs(2),
9393
Run: func(cmd *cobra.Command, args []string) {
9494
//修改成功时,返回 1 。 如果 NEW_KEY_NAME 已经存在,返回 0 。

cmd/godis/set.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var SMembersCmdShort = SMembersCmd
5151
var SMembersCmd = &cobra.Command{
5252
Use: "smembers [key]",
5353
Aliases: []string{"sget"},
54-
Short: "get set key values",
54+
Short: "Get set key values",
5555
Args: cobra.ExactArgs(1),
5656
Run: func(cmd *cobra.Command, args []string) {
5757
result := SMembers(args[0])
@@ -84,7 +84,7 @@ func SMembers(key string) []byte {
8484
var SAddCmdShort = SAddCmd
8585
var SAddCmd = &cobra.Command{
8686
Use: "sadd [key] member1 member2 member3...",
87-
Short: "add a set key",
87+
Short: "Add a set key",
8888
Args: cobra.RangeArgs(2, int(^uint(0)>>1)),
8989
Run: func(cmd *cobra.Command, args []string) {
9090
members := make([]interface{}, len(args))

0 commit comments

Comments
 (0)