* feat(spin): Add support for `--show-error` for the spinner.
This makes it so that if the `--show-error` flag is provided then the
full output of the command will be printed if the command fails. This
kind of works in conjuncture with `--show-output` in that if the command
succeeds only STDOUT is pushed. If the command fails both `STDOUT` and
`STDERR` are pushed.
This builds off of https://github.com/charmbracelet/gum/pull/371Resolves#55
* chore: Fix formatting
---------
Co-authored-by: Elliot Courant <me@elliotcourant.dev>
The isTTY check is inverted in the --show-output option for spin, so no
output is shown anymore. Fix this by correctly checking if we are a tty
or not.
* Added live output buffer and option flag
* Update Spin on README.md
* Returned output formatting to previous version.
* Separated the showOutput and liveOutput flags.
Both flags can now be used at once.
* Removed liveOutout flag
showOutput flag is now realtime
* (spin) Consolodated stderr and stdout
* (spin) Consolodated stdout and stderr
* (spin) If being piped, writes to stdout
* Added error check and did some housekeeping
* No longer outputs to tea.View if piped
* Cleaned up the combining of stderr and stdout
* Fixed spinner alignment. Updated Readme
Sometimes it is nice to spin to the right side of the title, not the
left, so add a --align option to pick the left or right side. The
default remains "left".
New option is:
--align="left|right"
and the environment variable GUM_SPIN_ALIGN can also be used.
* feat: pass stderr
Pass stderr from the command run by gum spin analog to how stdout is passed.
#63
* Apply suggestions from code review
* Update spin/spin.go
* fix(spin): Add stderr to output
When `--show-output` is passed we should display all the output of the
command and allow scripters to control `stderr` and `stdout` how they
want.
For example, if a user wants only `stdout` they can redirect stderr to
`/dev/null`:
```
gum spin --show-output -- <action> 2> /dev/null
```
Co-authored-by: Maas Lalani <maas@lalani.dev>
Instead of needing to run the commands manually in main.go, we can implement the `Run(...) error` method to satisfy the command interface so that `kong` can Run our commands for us.
This commit uses the embedded style struct for styling in all components. The most notable example is `gum write` where there are many styles that are used and composed for each component of the command.
Spin provides a shell script interface for the spinner bubble. It is
useful for displaying that some task is running in the background while
consuming it's output so that it is not shown to the user.
For example, let's do a long running task:
```
sleep 5
```
We can simply prepend a spinner to this task to show it to the user,
while performing the task / command in the background.
```
gum spin -t "Taking a nap..." -- sleep 5
```
The spinner will automatically exit when the task is complete.