Commit Graph

29 Commits

Author SHA1 Message Date
Maas Lalani
2a6767080f
Drop Tree (#330)
* fix: move tree to internal

* feat: tree indenter on lists

* fix: sublist example

* fix: remove tree
2024-07-11 17:23:29 -04:00
Ayman Bagabas
e6edbaca76
chore: bump x/ansi to v0.1.3
Fixes: https://github.com/charmbracelet/lipgloss/issues/324
2024-07-10 09:58:42 -04:00
Christian Rocha
bbd02ab316
chore(ci): also build examples (#310)
* chore(ci): also build examples
* fix(examples): fix tree styles example
* fix: ssh examples dependencies
* chore: use creack/pty
* chore(examples): update deps
* chore(examples): bump examples (and ci) to 1.19 so a slog dep will build

---------

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
2024-06-04 15:26:11 -04:00
Christian Rocha
e54d9dd05a fix(tree): examples 2024-05-31 12:54:58 -04:00
Maas Lalani
878d31f064
fix: sublist example, minor edits 2024-05-31 11:45:23 -04:00
Maas Lalani
6e07abb123
refactor: use lipgloss copy for example (#308) 2024-05-30 18:37:17 -04:00
Christian Rocha
70c908de3e
chore: remove deprecated Copy() calls (#306)
Co-authored-by: Maas Lalani <maas@lalani.dev>
2024-05-30 17:57:06 -04:00
Maas Lalani
1afeca0d80
Tree API Changes (#307)
* 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
2024-05-30 17:11:28 -04:00
Carlos Alexandro Becker
d21c576fdf
feat: trees and lists (#264)
* feat: implement list renderer

* feat: data model for list

* feat: add Offset, Height, Indent

* feat: tree renderer

* fix: list example

* test: last tree node is a subtree

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: tree

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: lint

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* docs: example

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* test: inc cov

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: multiline items

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* feat: one approach to sublists

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: tree improvements

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: prevent having to pass renderer to all trees

* test: force linux line endings

* fix: windows

* fix: lint issues

* fix: ignore lint issue failing forever

* fix: renames

* fix: renderer

* ci: fix coveralls hopefully

* wip

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: style

* docs: update

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: renderer

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* test: cover with tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* feat: more list enumerators

* fix: drop renderer api

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* feat: improve api

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: prealloc

* fix: clean up

* fix: list setup

* fix: improve sublist tests

* fix: improve sublists

* refactor: simplify

* docs: more examples, readme updates

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* docs: readme

* fix: set item style

* fix(tree): do not use golden files

* test: do not use golden files

* refactor: remove unused code

* feat: hide nodes

* feat: filter

* fix: allow fmt.Stringer

* test: table within a tree

* docs: update

* fix: rename atter to data

* test: test public api only

* docs: sublist with table example

* docs: update example

* fix: lint issues

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* docs: update examples

* docs: update

* feat: offset

* feat: offsetstart && offsetend

* fix: remove last from enumerator

* refactor: make tree more explicit

* `New()` now take no args
* added a new `Root(string)` method
* added a new `Items(...any)` method

* refactor: improve list

* docs: fix examples

* test: ensure embed lists in trees

* docs: sublist example with list as tree node

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* refactor: first pass at examples cleanup

* refactor: first pass at examples cleanup

* fix: support multi-line prefixes

* test: more glow-style lists within trees

* docs: simplify examples

* fix: improve handling of different types

* chore: go mod tidy

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: code review suggestions

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Co-authored-by: bashbunni <15822994+bashbunni@users.noreply.github.com>

* fix: apply code review suggestion

* feat(tree): rounded enumerator (#280)

* chore(examples): go mod tidy

* feat(tree): add rounded corner enumerator

* test: rounded enumerator test

* docs: readme updates

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* docs: readme updates

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* chore: fmt

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* docs: godoc

* docs: godoc

* fix: bash's issue

* fix: bad example

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* docs: improve godoc for trees and lists (#296)

* docs(godoc): add overview

* docs(godoc): include examples in godoc

* docs(godoc): fix roman numerals example

* docs(godoc): fix tree examples

* docs(godoc): attempt to fix list Enumerator examples

* docs: added some examples to godoc

* fix(list): New(items...) with sublist

* docs: update examples

* chore(tree): improve var names in rounded example

* fix: use padding instead of margin to better styles

* fix: lint

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Maas Lalani <maas@lalani.dev>
Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Co-authored-by: bashbunni <15822994+bashbunni@users.noreply.github.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2024-05-24 12:02:18 -03:00
Ayman Bagabas
83fa9be7fe
chore: use x/ansi instead of exp/term 2024-05-15 14:59:47 -04:00
Ayman Bagabas
2b58c4b607
Merge branch 'master' into who-needs-copy 2024-05-01 15:04:00 -04:00
Ayman Bagabas
0d3715fd49
chore: update examples to remove deprecated Copy() 2024-05-01 14:15:02 -04:00
dependabot[bot]
29fafad5be
chore(deps): bump golang.org/x/crypto from 0.1.0 to 0.17.0 in /examples (#277)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.1.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.1.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-29 15:44:34 -04:00
Ayman Bagabas
83959f5d94
chore: go mod tidy 2024-03-29 15:16:13 -04:00
Ayman Bagabas
f6f93348b0
feat: switch to term/ansi for text manipulation (#268)
* feat: switch to term/ansi for text manipulation

Use ANSI aware, wide characters support, uniseg backed term/ansi package
to calculate string widths, truncate, and wrap strings.

Related: https://github.com/muesli/reflow/pull/71
Fixes: https://github.com/charmbracelet/lipgloss/issues/258
Fixes: https://github.com/charmbracelet/lipgloss/issues/220

* Update get.go
2024-03-29 15:05:18 -04:00
Maas Lalani
439c06fae6
docs(table): ANSI-aware cell example 2024-03-05 10:35:45 -05:00
Christian Rocha
13584f26de chore: go mod tidy 2024-02-13 10:31:21 -05:00
Maas Lalani
f093bc1509
Make headers []string (#234)
* fix: make headers `[]string`

* downgrade Lip Gloss to 1.17
2023-10-12 00:53:13 -04:00
Maas Lalani
42db873617
test(table): ensure README example works 2023-10-10 11:32:42 -04:00
Maas Lalani
4476263d05
Feature: Tables (#218)
* feat: tables

* fix(table): examples

* docs(table): `any` -> `string`

* chore: go mod tidy

* docs(table): update image

* fix(table): lint

* fix: remove binary

* chore: color adjustments to pokemon example (#231)

* fix(table): support rendering empty data sets

* chore(table): simplify table's data interface

* fix(table): correct GoDoc + add doc comments to Data methods

---------

Co-authored-by: Christian Rocha <christian@rocha.is>
Co-authored-by: Christian Muehlhaeuser <muesli@gmail.com>
2023-10-10 10:27:52 -04:00
dependabot[bot]
7611cdfffe
chore(deps): bump golang.org/x/crypto in /examples (#192)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20220307211146-efcb8507fb70 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-04 12:59:17 -04:00
Christian Muehlhaeuser
233079e2d9 fix: go mod tidy examples 2023-06-28 17:01:41 +02:00
Christian Rocha
19ca9a3f8c
docs: renderer documentation (#175)
* docs(readme): add some context to the examples

* docs(readme): revert to render-function-based initial example

* docs(readme): drop extraneous stringer usage

* docs(readme): copyedits

* docs(renderer): minor documentation improvements

* docs(readme): edit renderer section to focus on custom outputs

* docs(readme): for now just use SetString to illustrate stringer

* docs(readme): re-add Ayman's clever stringer example

* docs(examples): tidy up wish example

* docs(examples): improve wish example

* docs(examples): session is an io.Writer

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>

* docs(examples): add missing pty argument

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>

* docs(example): remove extra space

* fix(examples): use termenv output

---------

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
2023-03-08 14:51:26 -05:00
Ayman Bagabas
b3440ac41f feat(go): bump termenv to v0.15 2023-03-08 09:54:27 -08:00
Ayman Bagabas
4eea195dfa feat(go): upgrade golang to 1.17
feat(examples): upgrade golang to 1.17
2023-03-07 16:44:08 +01:00
Ayman Bagabas
776c15f0da chore(examples): update ssh example
chore(examples): go mod tidy
2023-02-09 11:59:54 -05:00
Ayman Bagabas
e5401eb8b8 feat(renderer): add WithTermenvOutput option 2023-02-09 11:59:54 -05:00
Ayman Bagabas
4aa1f38785 chore: use unified examples go.mod 2023-02-09 11:59:54 -05:00
Ayman Bagabas
3fe14d0547 chore: add ssh example 2023-02-09 11:59:54 -05:00