Add Tree() method back in.

Needed for one of the examples and for backward compatability.
This commit is contained in:
Dan Cripe 2016-01-07 09:54:10 -06:00
parent d0e806295b
commit 7f88ba2640
1 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,12 @@ type PrefixCompleter struct {
Children []PrefixCompleterInterface
}
func (p *PrefixCompleter) Tree(prefix string) string {
buf := bytes.NewBuffer(nil)
p.Print(prefix, 0, buf)
return buf.String()
}
func Print(p PrefixCompleterInterface, prefix string, level int, buf *bytes.Buffer) {
if strings.TrimSpace(string(p.GetName())) != "" {
buf.WriteString(prefix)