File tree 3 files changed +39
-1
lines changed
3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ func main() {
128
128
// register shell commands
129
129
for _ , cmd := range RegisteredCmds {
130
130
handler := cmd .Handler ()
131
+ completer := cmd .Completer ()
131
132
longhelp := cmd .LongHelp ()
132
133
shell .AddCmd (& ishell.Cmd {
133
134
Name : cmd .Name (),
Original file line number Diff line number Diff line change @@ -14,7 +14,9 @@ type Cmd interface {
14
14
Name () string
15
15
// Alias is the alias of the command
16
16
Alias () []string
17
- // Handler is the handler of the command. A *ishell.Context object named
17
+ // Handler is the handler of the command
18
18
// `ishell` is stored in ctx
19
19
Handler () func (ctx context.Context )
20
+ // Completer
21
+ // Completer() func(ctx context.Context, args []string) []string
20
22
}
Original file line number Diff line number Diff line change 1
1
package tcli
2
2
3
+ ///////////////////// scan options //////////////////////
3
4
var (
4
5
ScanOptKeyOnly string = "key-only"
5
6
ScanOptCountOnly string = "count-only"
6
7
ScanOptLimit string = "limit"
7
8
ScanOptStrictPrefix string = "strict-prefix"
8
9
)
9
10
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 ////////////////
10
22
var (
11
23
DeleteOptWithPrefix string = "prefix-mode"
12
24
DeleteOptBatchSize string = "batch-size"
13
25
DeleteOptLimit string = "limit"
14
26
DeleteOptYes string = "yes"
15
27
)
16
28
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 //////////////////////
17
39
var (
18
40
LoadFileOptBatchSize string = "batch-size"
19
41
)
20
42
43
+ var LoadFileOptsKeywordList = []string {
44
+ LoadFileOptBatchSize ,
45
+ }
46
+
47
+ //////////////// end of loadcsv options ///////////////
48
+
49
+ ///////////////// backup options /////////////////////
21
50
var (
22
51
BackupOptBatchSize string = "batch-size"
23
52
)
53
+
54
+ var BackupOptsKeywordList = []string {
55
+ BackupOptBatchSize ,
56
+ }
57
+
58
+ //////////////// end of backup options ///////////////
You can’t perform that action at this time.
0 commit comments