Skip to content

Commit

Permalink
fix: tree examples
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed May 31, 2024
1 parent 878d31f commit 2114d37
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions examples/tree/background/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ func main() {
ItemStyle(itemStyle).
EnumeratorStyle(enumeratorStyle).
Root("# Table of Contents").
Item(
Child(
tree.New().
Root("## Chapter 1").
Item("Chapter 1.1").
Item("Chapter 1.2"),
Child("Chapter 1.1").
Child("Chapter 1.2"),
).
Item(
Child(
tree.New().
Root("## Chapter 2").
Item("Chapter 2.1").
Item("Chapter 2.2"),
Child("Chapter 2.1").
Child("Chapter 2.2"),
)

fmt.Println(t)
Expand Down
2 changes: 1 addition & 1 deletion examples/tree/files/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func main() {
return err
}
if info.IsDir() {
t.Item(tree.New().Root(path))
t.Child(tree.New().Root(path))
}
return nil
})
Expand Down
8 changes: 4 additions & 4 deletions examples/tree/rounded/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ func main() {

t := tree.New().
Root("Groceries").
Items(
Child(
tree.New().
Root("Fruits").
Items(
Child(
"Blood Orange",
"Papaya",
"Dragonfruit",
"Yuzu",
),
tree.New().
Root("Items").
Items(
Child(
"Cat Food",
"Nutella",
"Powdered Sugar",
),
tree.New().
Root("Veggies").
Items(
Child(
"Leek",
"Artichoke",
),
Expand Down
16 changes: 8 additions & 8 deletions examples/tree/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
func main() {
t := tree.New().
Root(".").
Item("Item 1").
Item(
Child("Item 1").
Child(
tree.New().
Root("Item 2").
Item("Item 2.1").
Item("Item 2.2").
Item("Item 2.3"),
Child("Item 2.1").
Child("Item 2.2").
Child("Item 2.3"),
).
Item(
Child(
tree.New().
Root("Item 3").
Item("Item 3.1").
Item("Item 3.2"),
Child("Item 3.1").
Child("Item 3.2"),
)

fmt.Println(t)
Expand Down

0 comments on commit 2114d37

Please sign in to comment.