Commit graph

28 commits

Author SHA1 Message Date
Maas Lalani 598ee57330
fix: lint 2024-03-28 13:21:51 -04:00
Jelle Besseling f4d198396f
feat(spin): Add support for --show-error for the spinner. (rebase #440) (#518)
* 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/371

Resolves #55

* chore: Fix formatting

---------

Co-authored-by: Elliot Courant <me@elliotcourant.dev>
2024-03-28 13:11:07 -04:00
Maas Lalani 6a275b423f
feat(spin): stdout streaming (#467) 2023-12-21 15:09:00 -05:00
Rose Thatcher 4a00db207a
Spin output can still be piped if timeout occurs (#461) 2023-12-13 13:54:14 -05:00
Maas Lalani 4d75f110a7
fix(spinner): hide spinner when done 2023-12-13 12:26:10 -05:00
Rose Thatcher 5c65944c66
(fix): ShowOutput flag displays in realtime (#405) 2023-11-29 16:54:57 -05:00
Maas Lalani 01a66511a1
Hide Style Flags consistently (#457)
* refactor: hide style flags on error to not clutter usage

* docs(style): add comment regarding dynamically hiding flags
2023-11-28 14:17:57 -05:00
Greg Kroah-Hartman a63ea30136
spin: fix isTTY check (#404)
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.
2023-07-28 10:40:18 -04: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
Maas Lalani 2e4ddce3f7
fix: use program.Start 2022-10-17 20:23:59 -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
Maas Lalani 4e61c120b0 fix: run spinner on stderr 2022-08-04 13:50:42 -04:00
Maas Lalani 46ce0e4761 feat: allow configuration via environment variables 2022-08-04 11:22:42 -04:00
Maas Lalani bba0f3b1e0
refactor: remove unneeded set:"name=" 2022-08-03 12:28:02 -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
Ayman Bagabas eaef49cdbe
feat: autocompletion 2022-07-25 13:03:18 -04:00
Maas Lalani 4f1d174175
feat: add -s short flag for spinner 2022-07-20 13:26:44 -04:00
Maas Lalani 5de4df66d2
refactor: add package comments describing behavior 2022-07-13 09:55:36 -04:00
Maas Lalani 7190822247
refactor(kong): Implement Run(...) error interface
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.
2022-07-12 22:33:52 -04:00
Maas Lalani 02e925ea57
refactor: use embedded style struct for all lipgloss styling
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.
2022-07-12 16:08:33 -04:00
Maas Lalani fa4f09a413
feat: Default accent color is 212 (Bubble Gum Pink) 2022-07-07 17:46:22 -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