mirror of
https://github.com/charmbracelet/lipgloss.git
synced 2024-08-17 01:40:36 +03:00
fix(tree): examples
This commit is contained in:
parent
878d31f064
commit
e54d9dd05a
@ -24,17 +24,17 @@ func main() {
|
|||||||
ItemStyle(itemStyle).
|
ItemStyle(itemStyle).
|
||||||
EnumeratorStyle(enumeratorStyle).
|
EnumeratorStyle(enumeratorStyle).
|
||||||
Root("# Table of Contents").
|
Root("# Table of Contents").
|
||||||
Item(
|
Child(
|
||||||
tree.New().
|
tree.New().
|
||||||
Root("## Chapter 1").
|
Root("## Chapter 1").
|
||||||
Item("Chapter 1.1").
|
Child("Chapter 1.1").
|
||||||
Item("Chapter 1.2"),
|
Child("Chapter 1.2"),
|
||||||
).
|
).
|
||||||
Item(
|
Child(
|
||||||
tree.New().
|
tree.New().
|
||||||
Root("## Chapter 2").
|
Root("## Chapter 2").
|
||||||
Item("Chapter 2.1").
|
Child("Chapter 2.1").
|
||||||
Item("Chapter 2.2"),
|
Child("Chapter 2.2"),
|
||||||
)
|
)
|
||||||
|
|
||||||
fmt.Println(t)
|
fmt.Println(t)
|
||||||
|
@ -19,7 +19,7 @@ func main() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
t.Item(tree.New().Root(path))
|
t.Child(tree.New().Root(path))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -13,10 +13,10 @@ func main() {
|
|||||||
|
|
||||||
t := tree.New().
|
t := tree.New().
|
||||||
Root("Groceries").
|
Root("Groceries").
|
||||||
Items(
|
Child(
|
||||||
tree.New().
|
tree.New().
|
||||||
Root("Fruits").
|
Root("Fruits").
|
||||||
Items(
|
Child(
|
||||||
"Blood Orange",
|
"Blood Orange",
|
||||||
"Papaya",
|
"Papaya",
|
||||||
"Dragonfruit",
|
"Dragonfruit",
|
||||||
@ -24,14 +24,14 @@ func main() {
|
|||||||
),
|
),
|
||||||
tree.New().
|
tree.New().
|
||||||
Root("Items").
|
Root("Items").
|
||||||
Items(
|
Child(
|
||||||
"Cat Food",
|
"Cat Food",
|
||||||
"Nutella",
|
"Nutella",
|
||||||
"Powdered Sugar",
|
"Powdered Sugar",
|
||||||
),
|
),
|
||||||
tree.New().
|
tree.New().
|
||||||
Root("Veggies").
|
Root("Veggies").
|
||||||
Items(
|
Child(
|
||||||
"Leek",
|
"Leek",
|
||||||
"Artichoke",
|
"Artichoke",
|
||||||
),
|
),
|
||||||
|
@ -9,19 +9,19 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
t := tree.New().
|
t := tree.New().
|
||||||
Root(".").
|
Root(".").
|
||||||
Item("Item 1").
|
Child("Item 1").
|
||||||
Item(
|
Child(
|
||||||
tree.New().
|
tree.New().
|
||||||
Root("Item 2").
|
Root("Item 2").
|
||||||
Item("Item 2.1").
|
Child("Item 2.1").
|
||||||
Item("Item 2.2").
|
Child("Item 2.2").
|
||||||
Item("Item 2.3"),
|
Child("Item 2.3"),
|
||||||
).
|
).
|
||||||
Item(
|
Child(
|
||||||
tree.New().
|
tree.New().
|
||||||
Root("Item 3").
|
Root("Item 3").
|
||||||
Item("Item 3.1").
|
Child("Item 3.1").
|
||||||
Item("Item 3.2"),
|
Child("Item 3.2"),
|
||||||
)
|
)
|
||||||
|
|
||||||
fmt.Println(t)
|
fmt.Println(t)
|
||||||
|
Loading…
Reference in New Issue
Block a user