-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bring-tree-back-v2' into alpha-tree
- Loading branch information
Showing
22 changed files
with
439 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/lipgloss" | ||
"github.com/charmbracelet/lipgloss/tree" | ||
) | ||
|
||
func main() { | ||
enumeratorStyle := lipgloss.NewStyle(). | ||
Background(lipgloss.Color("0")). | ||
Padding(0, 1) | ||
|
||
headerItemStyle := lipgloss.NewStyle(). | ||
Background(lipgloss.Color("#ee6ff8")). | ||
Foreground(lipgloss.Color("#ecfe65")). | ||
Bold(true). | ||
Padding(0, 1) | ||
|
||
itemStyle := headerItemStyle.Background(lipgloss.Color("0")) | ||
|
||
t := tree.Root("# Table of Contents"). | ||
RootStyle(itemStyle). | ||
ItemStyle(itemStyle). | ||
EnumeratorStyle(enumeratorStyle). | ||
Child( | ||
tree.Root("## Chapter 1"). | ||
Child("Chapter 1.1"). | ||
Child("Chapter 1.2"), | ||
). | ||
Child( | ||
tree.Root("## Chapter 2"). | ||
Child("Chapter 2.1"). | ||
Child("Chapter 2.2"), | ||
) | ||
|
||
fmt.Println(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/charmbracelet/lipgloss" | ||
"github.com/charmbracelet/lipgloss/tree" | ||
) | ||
|
||
func main() { | ||
enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("240")).PaddingRight(1) | ||
itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("99")).Bold(true).PaddingRight(1) | ||
|
||
t := tree.Root(".").EnumeratorStyle(enumeratorStyle).ItemStyle(itemStyle) | ||
_ = filepath.Walk(".", func(path string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if info.IsDir() { | ||
t.Child(tree.Root(path)) | ||
} | ||
return nil | ||
}) | ||
|
||
fmt.Println(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/lipgloss" | ||
"github.com/charmbracelet/lipgloss/tree" | ||
) | ||
|
||
func main() { | ||
enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("99")).MarginRight(1) | ||
itemStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("212")).MarginRight(1) | ||
|
||
t := tree. | ||
Root("Makeup"). | ||
Child( | ||
"Glossier", | ||
"Claire’s Boutique", | ||
"Nyx", | ||
"Mac", | ||
"Milk", | ||
). | ||
Enumerator(tree.RoundedEnumerator). | ||
EnumeratorStyle(enumeratorStyle). | ||
ItemStyle(itemStyle). | ||
RootStyle(lipgloss.NewStyle().Foreground(lipgloss.Color("#04B575"))) | ||
|
||
fmt.Println(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/lipgloss" | ||
"github.com/charmbracelet/lipgloss/tree" | ||
) | ||
|
||
func main() { | ||
itemStyle := lipgloss.NewStyle().MarginRight(1) | ||
enumeratorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("8")).MarginRight(1) | ||
|
||
t := tree.Root("Groceries"). | ||
Child( | ||
tree.Root("Fruits"). | ||
Child( | ||
"Blood Orange", | ||
"Papaya", | ||
"Dragonfruit", | ||
"Yuzu", | ||
), | ||
tree.Root("Items"). | ||
Child( | ||
"Cat Food", | ||
"Nutella", | ||
"Powdered Sugar", | ||
), | ||
tree.Root("Veggies"). | ||
Child( | ||
"Leek", | ||
"Artichoke", | ||
), | ||
).ItemStyle(itemStyle).EnumeratorStyle(enumeratorStyle).Enumerator(tree.RoundedEnumerator) | ||
|
||
fmt.Println(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/lipgloss/tree" | ||
) | ||
|
||
func main() { | ||
t := tree.Root("."). | ||
Child("Item 1"). | ||
Child( | ||
tree.New(). | ||
Root("Item 2"). | ||
Child("Item 2.1"). | ||
Child("Item 2.2"). | ||
Child("Item 2.3"), | ||
). | ||
Child( | ||
tree.New(). | ||
Root("Item 3"). | ||
Child("Item 3.1"). | ||
Child("Item 3.2"), | ||
) | ||
|
||
fmt.Println(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/lipgloss" | ||
"github.com/charmbracelet/lipgloss/tree" | ||
) | ||
|
||
func main() { | ||
purple := lipgloss.NewStyle().Foreground(lipgloss.Color("99")).MarginRight(1) | ||
pink := lipgloss.NewStyle().Foreground(lipgloss.Color("212")).MarginRight(1) | ||
|
||
t := tree.New(). | ||
Child( | ||
"Glossier", | ||
"Claire’s Boutique", | ||
tree.Root("Nyx"). | ||
Child("Lip Gloss", "Foundation"). | ||
EnumeratorStyle(pink), | ||
"Mac", | ||
"Milk", | ||
). | ||
EnumeratorStyle(purple) | ||
fmt.Println(t) | ||
} |
Oops, something went wrong.