Commit Graph

220 Commits

Author SHA1 Message Date
Carlos Alexandro Becker 25022e9789
example: using the x/exp/teatest package (#352)
teatest was originally designed in this PR, and was later moved into `github.com/charmbracelet/x`.

* docs: example test

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

* feat: teatest

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

* fix: improve api

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

* fix: improve api

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

* feat: goldenfiles

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

* chore: minor improvements

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

* feat: type text, diff

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

* fix: release terminal

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

* fix: lint

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

* fix: update cancelreader

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

* fix: make it safe

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

* feat: functional options

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

* feat: IsQuit and IsQuitMsg

* fix: save file

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

* fix: do not use deprecate func

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

* fix: make diff not complain about trailing whitespaces

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

* feat: with term size

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

* feat: RequireRegexOutput

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

* fix: update

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

* chore: rename

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

* fix: improve reliability

* fix: use returned model

* fix: making it more predictable, avoid sleeps

* fix: remove WithRequiredRegexpOutput

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

* fix: allow to assert within interactions

* feat: added wait for

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

* fix: optional

* feat: improve usage

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

* fix: use udiff

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

* feat: tea.Wait

wait for the underlying context to finish.

extract from #352

* fix: merge

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

* fix: wait til the end of shutdown

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

* fix: final output

* feat: use x/exp/teatest

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

* chore: go mod tidy

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

---------

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-05 16:14:26 -03:00
Christian Muehlhaeuser c56884c0e2
feat: add generic event filter (#536)
`WithFilter` lets you supply an event filter that will be invoked
before Bubble Tea processes a `tea.Msg`. The event filter can return
any `tea.Msg` which will then get handled by Bubble Tea instead of
the original event. If the event filter returns nil, the event
will be ignored and Bubble Tea will not process it.

As an example, this could be used to prevent a program from
shutting down if there are unsaved changes.

Based on the fantastic work by @aschey and supersedes #521.

Resolves #472.
2023-04-17 22:02:55 +02:00
Christian Muehlhaeuser 273f59bd11 fix: adapt to lipgloss API change 2023-04-04 13:27:12 +02:00
Christian Muehlhaeuser 6eb0209d13 chore: bump termenv, lipgloss, x/term 2023-04-04 13:27:12 +02:00
muesli 248eb83001 chore: go mod tidy tutorials and examples 2023-03-16 10:09:43 +00:00
Christian Muehlhaeuser 35c31f2168 chore: bump console dep 2023-03-13 18:09:44 +01:00
Maas Lalani 90c9124b0a
Filepicker Example (#683)
* feat: filepicker example

* fix: use new API

* docs(examples): update file selection comment in filepicker example

* chore: bump bubbles

---------

Co-authored-by: Christian Rocha <christian@rocha.is>
2023-03-06 11:54:26 -05:00
dependabot[bot] 388c67d573
feat(deps): bump golang.org/x/text from 0.3.7 to 0.3.8 (#674) 2023-02-23 16:29:25 +00:00
Ayman Bagabas c61e4fd291
chore: update deps
Fixes: CVE-2022-27664 https://github.com/advisories/GHSA-69cg-p879-7622
2023-02-21 12:43:58 -05:00
Glenn Gonda 4880cf2a09 docs: fix typos and clean up comments 2023-02-19 08:45:22 -05:00
Christian Rocha 1ad9f9c15c chore(deps): bump termenv and go-isatty
Also bump various deps in tutorials and examples
2023-02-08 10:04:56 -05:00
dependabot[bot] b30cca3906 chore(deps): bump github.com/muesli/termenv in /examples
Bumps [github.com/muesli/termenv](https://github.com/muesli/termenv) from 0.13.0 to 0.14.0.
- [Release notes](https://github.com/muesli/termenv/releases)
- [Commits](https://github.com/muesli/termenv/compare/v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/muesli/termenv
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-08 09:36:45 -05:00
Christoffer Åström e95e1a0db5 feat: `sequence` support `BatchMsg` 2023-02-07 10:06:46 -05:00
dependabot[bot] ede4aec24e chore(deps): bump github.com/mattn/go-isatty in /examples
Bumps [github.com/mattn/go-isatty](https://github.com/mattn/go-isatty) from 0.0.16 to 0.0.17.
- [Release notes](https://github.com/mattn/go-isatty/releases)
- [Commits](https://github.com/mattn/go-isatty/compare/v0.0.16...v0.0.17)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-isatty
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-03 17:46:19 +01:00
Christian Rocha 3765727e65
docs(examples): add cellbuffer + harmonica example (#409) 2022-12-12 09:52:00 -05:00
Austin Vazquez e079831c31 Remove references to io/ioutil package
Package io/ioutil has been marked deprecated starting in Go 1.16.

Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2022-11-10 13:51:29 +01:00
dependabot[bot] 7ba62d4987 chore(deps): bump github.com/charmbracelet/glamour in /examples
Bumps [github.com/charmbracelet/glamour](https://github.com/charmbracelet/glamour) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/charmbracelet/glamour/releases)
- [Commits](https://github.com/charmbracelet/glamour/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: github.com/charmbracelet/glamour
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 13:50:14 +01:00
Martin Dosch 2d10416631 [codespell]: Fix typos. 2022-11-03 12:55:31 -04:00
Josh Soref 4aa9ce489b
docs: fix spelling / various typos (#526) 2022-10-11 14:40:01 +02:00
Christian Muehlhaeuser 6b77c8fc10 chore: rename StartReturningModel to Run
Added aliases for the old functions, but deprecated them.
2022-10-08 01:34:17 +02:00
Christian Muehlhaeuser 22d15efad7 chore: clean up linter errors in examples 2022-10-08 00:56:56 +02:00
Maas Lalani d20732aaea docs: add examples/gifs locally to repository 2022-10-03 15:07:28 -04:00
Maas Lalani 70576bc9e0
examples/README.md GIFs (#470)
* docs(examples): Add `examples/README.md`

Adds `examples/README.md` with GIFs of examples

* docs(examples): Individual READMEs

* docs(examples): add short description to each example
2022-10-03 12:06:18 -04:00
Matt Joiner d79ebda5cf
Fixes for examples/progress-download (#444) 2022-09-27 06:42:43 +02:00
Scott Leggett 900a842f50 fix: off-by-one error in spinner example 2022-09-27 05:53:21 +02:00
Christian Muehlhaeuser 6c449e55bf feat: use Termenv.Output to write to tty 2022-09-27 02:49:36 +02:00
Maas Lalani e5cbc04f94 docs: use styled glamour markdown within viewport 2022-09-23 16:46:56 -04:00
Christian Rocha 1a0beff868
chore: use go 1.16 (#449)
* chore: use go 1.16 and gofmt accordingly

* chore: also update examples and tuts to go 1.16
2022-09-14 19:08:36 -04:00
dependabot[bot] 8ddf2a308f chore(deps): bump github.com/charmbracelet/lipgloss in /examples
Bumps [github.com/charmbracelet/lipgloss](https://github.com/charmbracelet/lipgloss) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/charmbracelet/lipgloss/releases)
- [Commits](https://github.com/charmbracelet/lipgloss/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: github.com/charmbracelet/lipgloss
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-07 12:42:23 -04:00
Christian Rocha 127f76226e docs(example): set wordwrap in glamour example 2022-09-02 13:01:14 -07:00
Christian Rocha 989d49f3e6 feat: add Sequence for running commands in order. Closes #413.
This deprecates Sequentially.
2022-08-30 13:07:05 -07:00
bashbunni bb241ceb8b
docs: add debounce example (#348)
* docs: add debounce example

* refactor: reformat comments

Co-authored-by: Maas Lalani <maas@lalani.dev>

* refactor: init model before program start

Co-authored-by: Maas Lalani <maas@lalani.dev>

* feat: show tag in view

* docs(examples): improve debounce example comments

* docs(examples): remove extraneous lipgloss join

Co-authored-by: Maas Lalani <maas@lalani.dev>
Co-authored-by: Christian Rocha <christian@rocha.is>
2022-08-24 21:09:43 -07:00
bashbunni 30bb43e5ae
Composable view (#394)
* docs: creating nested models

* docs: move nested model to example

* docs: add working nested model example

* refactor: use tea.Batch in nested model example

* refactor: switch to composable view example

* refactor: tab select, add padding to boxes, only focused has border

* fix: add padding to timer to remove UI shift
2022-08-24 14:57:32 -07:00
Christian Rocha 31800cd0a7
fix(examples): remove unused type in textarea example 2022-08-19 09:29:18 -07:00
mattn 6b685056fc
fix: support multi-byte strings on Windows (#343)
* convert locale string to utf-8 on Windows

* update go.mod

* revert go fmt ./...

* fix(lint): use tabs in GoDoc example code

Co-authored-by: Christian Rocha <christian@rocha.is>
2022-08-19 09:25:22 -07:00
Maas Lalani a7f50a670c fix(split-editors): resize issue 2022-08-18 16:04:03 -04:00
Maas Lalani 8b7b7918d3 doc: Add table example 2022-08-18 15:09:02 -04:00
Sebastian Spaink 6faba760c2 docs: example interacting with tabs using lipgloss 2022-08-18 14:46:28 -04:00
Jerome Fitzgerald ae6fcd395e docs: README progress-download folder + ignore
📝 Update folder name in README to `progress-download` as
 that is what generates with `go build .`

🙈 Add the files genreated by `go build .` to root `.gitnore`
2022-08-18 12:57:30 -04:00
Christian Muehlhaeuser ca333e7d79 chore: bump go-isatty dep 2022-08-15 12:26:30 +02:00
dependabot[bot] ac4a1a1faa
feat(deps): bump github.com/muesli/cancelreader from 0.2.1 to 0.2.2 (#354)
* feat(deps): bump github.com/muesli/cancelreader from 0.2.0 to 0.2.2

Bumps [github.com/muesli/cancelreader](https://github.com/muesli/cancelreader) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/muesli/cancelreader/releases)
- [Commits](https://github.com/muesli/cancelreader/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: github.com/muesli/cancelreader
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: examples

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-07-21 10:02:18 -03:00
Maas Lalani 0a0182e55a
chore: Bump bubbles to v0.13.0 (#363) 2022-07-08 10:08:24 -04:00
Maas Lalani 27e356a779
Add border to split-editors example (#362)
* doc(textarea): add border to focused textarea in split-editors example
* doc(textrea): tone down with border color in split-editors example

Co-authored-by: Christian Rocha <christian@rocha.is>
2022-07-05 14:31:32 -04:00
Maas Lalani 642d26a793
doc: Add `textarea` examples (#357)
* chore: bump bubbles@master

* doc(textarea): Add example of `chat` application with textarea

* doc(textarea): Add example of `textarea` prompting the user to tell a story

* doc(textarea): Add example of `split-editors` on how to manage multiple textareas
2022-07-01 12:20:04 -04:00
Carlos Alexandro Becker ca32c4c628
feat: update cancelreader (#353)
* feat: update cancelreader

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

* fix: go mod tidy

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

* fix: go mod tidy

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

* fix: use stable

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-06-23 09:19:36 -03:00
Max ebabec7008
feat: print unmanaged output above the application (#249)
* merge Adjective-Object/tea_log_renderer into standard renderer

* rename queuedMessages -> queuedMessageLines & break apart strings during message processing

* delete cursorDownBy

* += 1 -> ++ to make the linter happy

* add skipLines[] tracking back to standard renderer, and add rename skippedLines local to jumpedLines to clarify they are separate comments

* request repaint when a message is recieved

* Convert Println and Printf to commands

* Add package manager example demonstrating tea.Printf

* Use Unix instead of UnixMicro for Go 1.13 support in CI

* fix off by one in std renderer

* add Printf/Println to tea.go

* revert attempt at sequence compression + cursorUpBy

Co-authored-by: Maxwell Huang-Hobbs <mahuangh@microsoft.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2022-06-22 12:53:02 -04:00
bashbunni a2d0ac9d38
docs: add another progress bar example (#270)
* docs: add another progress bar example

* chore: copy edits

Co-authored-by: Christian Rocha <christian@rocha.is>
2022-06-15 11:55:47 -07:00
Maas Lalani d56d8ae854
Example: Credit Card Input Form (#338)
* feat(cc): Add Credit Card Input Form Example and `ValidatorFuncs` to ensure credit cards are valid
2022-06-13 09:39:01 -04:00
Carlos Alexandro Becker b566614c16
docs: default to vim if no EDITOR on exec example (#325)
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-06-02 15:12:31 -03:00
Christian Rocha 04d68b8e3e chore(examples): bump bubbles dependency 2022-06-01 18:47:09 -07:00