add SetChildren for prefix completer interface

This commit is contained in:
招牌疯子 2016-03-16 18:03:13 +08:00
parent b57eccfd02
commit 3138d3552b
1 changed files with 5 additions and 0 deletions

View File

@ -12,6 +12,7 @@ type PrefixCompleterInterface interface {
Do(line []rune, pos int) (newLine [][]rune, length int) Do(line []rune, pos int) (newLine [][]rune, length int)
GetName() []rune GetName() []rune
GetChildren() []PrefixCompleterInterface GetChildren() []PrefixCompleterInterface
SetChildren(children []PrefixCompleterInterface)
} }
type PrefixCompleter struct { type PrefixCompleter struct {
@ -53,6 +54,10 @@ func (p *PrefixCompleter) GetChildren() []PrefixCompleterInterface {
return p.Children return p.Children
} }
func (p *PrefixCompleter) SetChildren(children []PrefixCompleterInterface) {
p.Children = children
}
func NewPrefixCompleter(pc ...PrefixCompleterInterface) *PrefixCompleter { func NewPrefixCompleter(pc ...PrefixCompleterInterface) *PrefixCompleter {
return PcItem("", pc...) return PcItem("", pc...)
} }