From 7f88ba2640acc27fe6ba9674d56aab37ee268469 Mon Sep 17 00:00:00 2001 From: Dan Cripe Date: Thu, 7 Jan 2016 09:54:10 -0600 Subject: [PATCH] Add Tree() method back in. Needed for one of the examples and for backward compatability. --- complete_helper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/complete_helper.go b/complete_helper.go index d14cc4a..2564a5c 100644 --- a/complete_helper.go +++ b/complete_helper.go @@ -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)