From 3138d3552b64f25c9f945c792a889d598981c80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8B=9B=E7=89=8C=E7=96=AF=E5=AD=90?= Date: Wed, 16 Mar 2016 18:03:13 +0800 Subject: [PATCH] add SetChildren for prefix completer interface --- complete_helper.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/complete_helper.go b/complete_helper.go index 2564a5c..4c10f51 100644 --- a/complete_helper.go +++ b/complete_helper.go @@ -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...) }