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>
* 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>
`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.
* 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>
* 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>
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>
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>