Commit Graph

735 Commits

Author SHA1 Message Date
Christian Rocha fcc805f3da chore: make input options mutually exclusive 2023-05-05 15:41:46 -04:00
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
Carlos Alexandro Becker 5326d76c40
feat: allow to disable signals (#721)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-05-04 16:33:25 -03:00
Carlos Alexandro Becker 9cc3861bab
feat: tea.Wait (#722)
* feat: tea.Wait

wait for the underlying context to finish.

extract from #352

* fix: wait til the end of shutdown

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

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-04 16:30:30 -03:00
Ayman Bagabas 29254a08f1
fix(output): reuse termenv output (#715)
If the passed io.Writer is a termenv.Output, use it instead of creating
a new termenv.Output.
2023-04-26 16:04:14 -04: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
bashbunni 8514d90b9e
docs: remove british spelling (#719) 2023-04-11 12:48:34 -07:00
bashbunni 5b809a3da8
docs: update issue templates (#712)
* docs: update issue templates

* add source code instructions
2023-04-06 10:34:23 -07:00
Christian Muehlhaeuser 58c5e01d8c chore: fix linter warnings 2023-04-04 13:27:12 +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
dependabot[bot] 9c161cb98b chore(deps): bump actions/setup-go from 3 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-16 11:09:15 +01:00
Christian Muehlhaeuser 35c31f2168 chore: bump console dep 2023-03-13 18:09:44 +01:00
Carlos Alexandro Becker adb0065256
feat: LogToFileWith (#692)
Allows to log to file with custom loggers, provided they implement
SetOutput and SetPrefix.
2023-03-09 11:46:44 -03:00
Christian Rocha de6740db2e
chore(meta): tiny copy edit to Discord item in issues 2023-03-08 09:27:11 -05:00
Carlos A Becker 02b6aa2e1a
docs: point to discord link 2023-03-08 10:19:08 -03:00
Carlos Alexandro Becker ec2c3dd5f2
docs: issue template (#389) 2023-03-08 09:51:43 -03:00
Vernon Miller 03060def9f docs(readme): add link to countdown project 2023-03-07 15:05:32 -05:00
Andrian Budantsov 40923b4491 Add WG Commander to README.md 2023-03-07 14:52:03 -05:00
Omar kamoun f0389a218d
feat(README): add eks-node-viewer to "Bubble Tea in the Wild" list (#619)
* docs: add awslabs/eks-node-viewer to Bubble Tea in the Wild
2023-03-07 14:50:41 -05:00
Christian Muehlhaeuser 402d2b4e2b fix: stop renderer before launching a child process.
Stops the renderer before starting a child process, which prevents
the repaint race condition that writes to non-altscreen.
2023-03-07 10:09:36 +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
Christian Muehlhaeuser a136799ed3 fix: renderer only stops once
Ensure the tea renderer can be stopped and restarted more than once.
2023-03-06 14:38:49 +01:00
Carlos Alexandro Becker 32e3027ec1
feat(ci): auto go mod tidy examples (#561)
* feat(ci): auto go mod tidy examples

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

* fix: tutorials as well

* fix: checkout

---------

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-02-23 13:51:15 -03:00
Carlos A Becker ae652b6a57
feat: go 1.17
This was actually done on #674, and merged in
388c67d573.

This commit is just for the sake of complete changelog.

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-02-23 13:33:07 -03: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
Mark Marryatt 76c3c1a221 docs: fix portal broken markdown URL 2023-02-16 17:42:54 -05:00
Alexander Jung 331a63bdca fix: Check if program cancelReader is is nil before invoking
This commit fixes an issue where a user may provider a nil input via
`tea.WithInput(nil)`.  This option method does not check if the input
is nil and sets the `withCustomInput` attribute with a nil input.
This logic is sound since a Tea program may not necessarily want to
handle any inputs from users (such as those in non-TTY environments).

However, a nil pointer exception is thrown during `tea.Run` because a
`cancelReader` is always invoked after the main renderer.  However,
its instantiation is variable and dependent on whether an input is
provided. To mitigate against this, this commit checks if a
`cancelReader` is non-nil.

Signed-off-by: Alexander Jung <alex@nderjung.net>
2023-02-08 17:04:49 +01: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
Christian Rocha cb23938f3f chore(docs): additional Bubble Tea in the wild cleanup 2023-02-08 09:53:02 -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
Christian Rocha db1a095425 chore(docs): cleanup Bubble Tea in the Wild 2023-02-08 09:27:29 -05:00
Christoffer Åström e95e1a0db5 feat: `sequence` support `BatchMsg` 2023-02-07 10:06:46 -05:00
koki-develop a3dc561104 docs: add cLive to "Bubble Tea in the Wild" 2023-02-06 14:17:49 -05:00
BoilingSoup d7bc683260 fix typo 2023-02-06 10:24:24 -05:00
Pradeep Chhetri 45cded1ffc Add chtop to the list built with bubbletea
Signed-off-by: Pradeep Chhetri <pradeepchhetri4444@gmail.com>
2023-02-06 10:22:14 -05:00
Brian Strauch da44346bd3 Update README.md 2023-02-06 10:17:36 -05:00
Petar Jager d2a775ef2e docs: add SlurmCommander to in-the-wild section 2023-01-23 10:04:45 -05:00
Yahya SayadArbabi fbecc47be2 feat(README): add enola to "Bubble Tea in the Wild" list 2023-01-23 09:53:14 -05:00
マリウス 263444cdfb docs: add Neon Modem Overdrive to "in the wild" 2023-01-23 09:51:40 -05:00
Alexander Jung b217449c8e fix: Check msg cmd is not nil before invoking
GitHub-Fixes: #639
Signed-off-by: Alexander Jung <alex@nderjung.net>
2023-01-23 09:47:19 -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
Solomon White b63a0ae37f docs: add brows to "in the wild" app list 2022-12-16 12:36:53 -05:00
Christian Rocha 3765727e65
docs(examples): add cellbuffer + harmonica example (#409) 2022-12-12 09:52:00 -05:00
Christian Muehlhaeuser 79c76c680b chore: disable dependabot timer 2022-11-18 02:17:42 +01:00
Ayman Bagabas 94d6f5079e
docs: update readme 2022-11-14 13:31:59 -08:00
Christian Muehlhaeuser 9c20a804d7 fix: don't close stdin
This allows programs to re-use stdin after the tea.Program has
finished.

Fixes #595.
2022-11-13 23:55:44 +01:00