Skip to content

Commit 4174e3a

Browse files
committed
add some comments
1 parent e4558f4 commit 4174e3a

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

cli/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func main() {
128128
// register shell commands
129129
for _, cmd := range RegisteredCmds {
130130
handler := cmd.Handler()
131+
completer := cmd.Completer()
131132
longhelp := cmd.LongHelp()
132133
shell.AddCmd(&ishell.Cmd{
133134
Name: cmd.Name(),

cmd.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ type Cmd interface {
1414
Name() string
1515
// Alias is the alias of the command
1616
Alias() []string
17-
// Handler is the handler of the command. A *ishell.Context object named
17+
// Handler is the handler of the command
1818
// `ishell` is stored in ctx
1919
Handler() func(ctx context.Context)
20+
// Completer
21+
// Completer() func(ctx context.Context, args []string) []string
2022
}

cmd_flags.go

+35
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,58 @@
11
package tcli
22

3+
///////////////////// scan options //////////////////////
34
var (
45
ScanOptKeyOnly string = "key-only"
56
ScanOptCountOnly string = "count-only"
67
ScanOptLimit string = "limit"
78
ScanOptStrictPrefix string = "strict-prefix"
89
)
910

11+
// for completer to work, keyword list
12+
var ScanOptsKeywordList = []string{
13+
ScanOptKeyOnly,
14+
ScanOptCountOnly,
15+
ScanOptLimit,
16+
ScanOptStrictPrefix,
17+
}
18+
19+
///////////////////// end of scan options ///////////////
20+
21+
//////////////// del/delp/delall options ////////////////
1022
var (
1123
DeleteOptWithPrefix string = "prefix-mode"
1224
DeleteOptBatchSize string = "batch-size"
1325
DeleteOptLimit string = "limit"
1426
DeleteOptYes string = "yes"
1527
)
1628

29+
var DeleteOptsKeywordList = []string{
30+
DeleteOptWithPrefix,
31+
DeleteOptBatchSize,
32+
DeleteOptLimit,
33+
DeleteOptYes,
34+
}
35+
36+
//////////////// end of del/delp/delall options ////////
37+
38+
///////////////// loadcsv options //////////////////////
1739
var (
1840
LoadFileOptBatchSize string = "batch-size"
1941
)
2042

43+
var LoadFileOptsKeywordList = []string{
44+
LoadFileOptBatchSize,
45+
}
46+
47+
//////////////// end of loadcsv options ///////////////
48+
49+
///////////////// backup options /////////////////////
2150
var (
2251
BackupOptBatchSize string = "batch-size"
2352
)
53+
54+
var BackupOptsKeywordList = []string{
55+
BackupOptBatchSize,
56+
}
57+
58+
//////////////// end of backup options ///////////////

0 commit comments

Comments
 (0)