-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: clean tree_test.go * refactor: remove subtests * refactor: rename `Data` to `Items` for `Lists` and `Children` for `Trees` * chore: support only NodeData * fix: enumerations -> enumerators for consistency * fix: item -> children * fix: use l for List, rather than n * fix: move list Enumerator definition to enumerator.go * fix: list enumerator comments * docs: add package documentation * fix: examples * feat: split enumerator and indenters * docs: add comments * refactor: package comment * docs: use more tree terminology * docs: refactor indentor comments * fix: lint
- Loading branch information
1 parent
d21c576
commit 1afeca0
Showing
16 changed files
with
995 additions
and
1,037 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
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,41 @@ | ||
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.New(). | ||
ItemStyle(itemStyle). | ||
EnumeratorStyle(enumeratorStyle). | ||
Root("# Table of Contents"). | ||
Item( | ||
tree.New(). | ||
Root("## Chapter 1"). | ||
Item("Chapter 1.1"). | ||
Item("Chapter 1.2"), | ||
). | ||
Item( | ||
tree.New(). | ||
Root("## Chapter 2"). | ||
Item("Chapter 2.1"). | ||
Item("Chapter 2.2"), | ||
) | ||
|
||
fmt.Println(t) | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.