Commit graph

12 commits

Author SHA1 Message Date
Maas Lalani 4d75f110a7
fix(spinner): hide spinner when done 2023-12-13 12:26:10 -05:00
Dieter Eickstaedt f8caeef195
feat: Timeout for Spin Command (#385)
* feat: Timeout for Spin Command

* fix: spin timeout

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-06-30 09:17:09 -04:00
Maas Lalani 6aac40560f
fix: isTTY & no new line 2023-06-27 10:36:33 -04:00
Rose Thatcher f048bd8d87
feat(Spin): Option to show live output (#303)
* 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
2023-06-27 10:31:54 -04:00
Greg Kroah-Hartman 6677920319 feat: add alignment for spinner title
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.
2022-10-02 14:42:19 -04:00
Maas Lalani 1479184f3f fix: satisfy all linters 2022-08-05 02:33:40 -04:00
Aaron Korte 01c7d96945
feat: pass stderr (#64)
* 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>
2022-08-01 13:24:01 -04:00
Maas Lalani b670c6d674 refactor: bubble up ErrAborted 2022-07-30 21:42:48 -04:00
Maas Lalani 61a9219d0a feat(spin): --show-output and exit code should match command's 2022-07-30 18:04:26 -04:00
Christian Muehlhaeuser 66993d8ef1
Add soft & hard linter configs & workflows (#44)
* chore: add linter configs & workflows

* fix: ignore certain linter warnings

* fix: mark errors as intentionally ignored

* fix: avoid unnecessary conversion

* fix: handle template/renderer errors

* fix: mark intentionally unused code
2022-07-30 12:32:59 -04:00
Maas Lalani 5de4df66d2
refactor: add package comments describing behavior 2022-07-13 09:55:36 -04:00
Maas Lalani 454040cf4d
feat: Add gum spin 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.
2022-07-07 13:29:10 -04:00