Skip to content

Commit 5e10c13

Browse files
chore: clean up LongShortCompleter a bit
1 parent 36d242c commit 5e10c13

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

completers/complete_long_short.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,15 @@ import (
77
"github.com/johnrichardrinehart/readline/runes"
88
)
99

10-
// type LongShortCompleterInterface interface {
11-
// Do(line []rune, pos int, long bool) (newLine [][]rune, length int)
12-
// GetName() []rune
13-
// GetChildren() []LongShortCompleterInterface
14-
// SetChildren(children []LongShortCompleterInterface)
15-
// }
16-
17-
// type DynamicLongShortCompleterInterface interface {
18-
// LongShortCompleterInterface
19-
// IsDynamic() bool
20-
// GetDynamicNames(line []rune) [][]rune
21-
// }
22-
2310
type LongShortCompleter struct {
2411
Name []rune
2512
Text []rune
26-
Dynamic bool
2713
Callback DynamicCompleteFunc
2814
Children []LongShortCompleter
29-
// Children []LongShortCompleterInterface
3015
}
3116

3217
func (p *LongShortCompleter) IsDynamic() bool {
33-
return p.Dynamic
18+
return p.Callback != nil
3419
}
3520

3621
func (p *LongShortCompleter) GetName() []rune {
@@ -54,15 +39,13 @@ func LongShortCompleterItem(name, text string, children ...LongShortCompleter) L
5439
return LongShortCompleter{
5540
Name: []rune(name),
5641
Text: []rune(text),
57-
Dynamic: false,
5842
Children: children,
5943
}
6044
}
6145

6246
func LongShortCompleterItemDynamic(callback DynamicCompleteFunc, children ...LongShortCompleter) LongShortCompleter {
6347
return LongShortCompleter{
6448
Callback: callback,
65-
Dynamic: true,
6649
Children: children,
6750
}
6851
}

0 commit comments

Comments
 (0)