Skip to content

Commit 439c06f

Browse files
committed
docs(table): ANSI-aware cell example
1 parent 652c37d commit 439c06f

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

examples/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/mattn/go-runewidth v0.0.15 // indirect
2424
github.com/mitchellh/go-homedir v1.1.0 // indirect
2525
github.com/muesli/reflow v0.3.0 // indirect
26-
github.com/rivo/uniseg v0.4.6 // indirect
26+
github.com/rivo/uniseg v0.4.7 // indirect
2727
golang.org/x/crypto v0.1.0 // indirect
2828
golang.org/x/sys v0.12.0 // indirect
2929
)

examples/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
7272
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7373
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
7474
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
75-
github.com/rivo/uniseg v0.4.6 h1:Sovz9sDSwbOz9tgUy8JpT+KgCkPYJEN/oYzlJiYTNLg=
76-
github.com/rivo/uniseg v0.4.6/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
75+
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
76+
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
7777
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
7878
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
7979
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

examples/table/ansi/main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/charmbracelet/lipgloss"
7+
"github.com/charmbracelet/lipgloss/table"
8+
)
9+
10+
func main() {
11+
s := lipgloss.NewStyle().Foreground(lipgloss.Color("240")).Render
12+
13+
t := table.New()
14+
t.Row("Bubble Tea", s("Milky"))
15+
t.Row("Milk Tea", s("Also milky"))
16+
t.Row("Actual milk", s("Milky as well"))
17+
fmt.Println(t.Render())
18+
}

0 commit comments

Comments
 (0)