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)