File: README.md

package info (click to toggle)
golang-github-pterm-pterm 0.12.79-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,640 kB
  • sloc: makefile: 4
file content (35 lines) | stat: -rw-r--r-- 658 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# tree/demo

![Animation](animation.svg)

```go
package main

import (
	"github.com/pterm/pterm"
)

func main() {
	// Define a tree structure using pterm.TreeNode
	tree := pterm.TreeNode{
		// The top node of the tree
		Text: "Top node",
		// The children of the top node
		Children: []pterm.TreeNode{{
			// A child node
			Text: "Child node",
			// The children of the child node
			Children: []pterm.TreeNode{
				// Grandchildren nodes
				{Text: "Grandchild node"},
				{Text: "Grandchild node"},
				{Text: "Grandchild node"},
			},
		}},
	}

	// Render the tree with the defined structure as the root
	pterm.DefaultTree.WithRoot(tree).Render()
}

```