Merge pull request #38 from buaazp/master

add SetChildren for prefix completer interface
This commit is contained in:
Chzyer 2016-03-16 18:32:27 +08:00
commit 402307d9c0
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)
GetName() []rune
GetChildren() []PrefixCompleterInterface
SetChildren(children []PrefixCompleterInterface)
}
type PrefixCompleter struct {
@ -53,6 +54,10 @@ func (p *PrefixCompleter) GetChildren() []PrefixCompleterInterface {
return p.Children
}
func (p *PrefixCompleter) SetChildren(children []PrefixCompleterInterface) {
p.Children = children
}
func NewPrefixCompleter(pc ...PrefixCompleterInterface) *PrefixCompleter {
return PcItem("", pc...)
}