Redirected from
github.com/konstantin8105/tree .
Discover Packages
github.com/Konstantin8105/tree
package
module
Version:
v0.1.1
Opens a new window with list of versions in this module.
Published: Jul 4, 2023
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
README
¶
tree
tree
is tree viewer.
minimal example:
func ExampleTree() {
artist := tree.New("Pantera")
album := tree.New("Far Beyond Driven")
album.Add("5 minutes Alone")
album.Add("Some another")
artist.Add(album)
artist.Add("Power Metal")
fmt.Fprintf(os.Stdout, "%s\n", artist)
// Output:
// Pantera
// ├──Far Beyond Driven
// │ ├──5 minutes Alone
// │ └──Some another
// └──Power Metal
}
Documentation:
package tree // import "github.com/Konstantin8105/tree"
Package tree create and print tree.
TYPES
type Tree struct {
Name string
// Has unexported fields.
}
Tree struct of tree
func New(name string) (tr *Tree)
New returns a new tree
func (t *Tree) Add(node interface{})
Add node in tree
func (t Tree) String() (out string)
String return string with tree view
Expand ▾
Collapse ▴
Documentation
¶
Package tree create and print tree.
type Tree struct {
Name string
}
Tree struct of tree
package main
import (
"fmt"
"os"
"github.com/Konstantin8105/tree"
)
func main() {
artist := tree.New("Pantera")
album := tree.New("Far Beyond Driven")
album.Add("5 minutes Alone")
album.Add("Some another")
artist.Add(album)
artist.Add("Power Metal")
fmt.Fprintf(os.Stdout, "%s\n", artist)
}
Output:
Pantera
├──Far Beyond Driven
│ ├──5 minutes Alone
│ └──Some another
└──Power Metal
func (t *Tree ) Add(node interface{})
Add node in tree
String return string with tree view
Source Files
¶
Click to show internal directories.
Click to hide internal directories.