Commit graph

40 commits

Author SHA1 Message Date
Carlos Alexandro Becker
2741e2eebb
fix(spin): if not a tty, only print title, do not open tty for stdin
closes #328
2024-12-10 21:47:00 -03:00
Carlos Alexandro Becker
afb6111258
fix(spinner): set stdin and stderr
fixes #266

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-12-10 11:48:47 -03:00
Carlos Alexandro Becker
4f469522d5
feat: handle interrupts and timeouts (#747) 2024-12-09 14:30:35 -03:00
Carlos Alexandro Becker
e30fc5ecdf
refactor: removing huh as a dep (#742)
* Revert "feat: huh gum write (#525)"

This reverts commit 4d5d53169e.

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

* Revert "Use Huh for Gum Confirm (#522)"

This reverts commit f7572e387e.

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

* revert: Use Huh for Gum Choose (#521)

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

* revert: feat: huh for gum input (#524)

* revert: feat: huh file picker (#523)

* feat: remove huh

* fix: timeouts

* fix: lint issues

* fix(choose): quit on ctrl+q

ported over 63a3e8c8ce

* fix: ctrl+a to reverse selection

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

* fix: better handle spin exit codes

* fix(file): bind --[no-]permissions and --[no-]size

* feat(confirm): show help

* fix(confirm): fix help style

* fix(file): help

* fix(input): --no-show-help doesn't work

* fix(input): help

* fix(file): keymap improvement

* fix(write): focus

* feat(write): ctrl+e, keymaps, help

* feat(choose): help

* feat(filter): help

* refactor: keymaps

* fix(choose): only show 'toggle all' if there's no limit

* fix(choose): don't show toggle if the choices are limited to 1

* fix(filter): match choose header color

* fix(filter): add space above help

* fix(filter): factor help into the height setting

* chore(choose,filter): use verb for navigation label in help

* fix(filter): hide toggle help if limit is 1

* fix(file): factor help into height setting (#746)

* fix: lint issues

* fix(file): handle ctrl+c

* fix: remove full help

* fix: lint

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2024-12-09 13:18:35 -03:00
Carlos Alexandro Becker
71af32ce16
fix(spin): properly redirect output
closes #690
2024-12-04 10:32:45 -03:00
Carlos Alexandro Becker
c3e836f0dd
fix(spin): interrupt child process on ctrl+c (#732)
* fix(spin): interrupt child process on ctrl+c

This will send a SIGINT to the child process when ctrl+c is pressed.

closes #730

* fix: lint
2024-11-27 14:58:21 -03:00
Carlos Alexandro Becker
098d09a270
fix(choose,confirm,file,filter,input,pager,spin): timeout default unit (#724)
Change it `0s` instead of `0`.

closes #402
2024-11-18 17:10:06 -03:00
Ayman Bagabas
7bdd189616
fix(spin): indenting lines when command is piped (#636)
We don't need to check for isatty, always store the output to the
designated buffer.

Fixes: https://github.com/charmbracelet/gum/issues/607
2024-11-15 15:53:27 -03:00
Ayman Bagabas
5d96f8479d chore: revert "fix(spin): pause tea before running the sub-process (#621)" 2024-07-24 16:43:40 -04:00
Ayman Bagabas
405f246635 refactor: use x/term instead of go-isatty 2024-07-16 15:17:46 -04:00
Ayman Bagabas
e569667282
fix(spin): pause tea before running the sub-process (#621)
We need to pause the main tea.Program process to restore the terminal
state before running the sub-process.

Fixes: https://github.com/charmbracelet/gum/issues/607
2024-07-16 13:07:34 -04:00
Maas Lalani
a8712df2a7
Show help with Huh? (#587)
* chore(deps): bump deps

* feat: show help using huh?

* fix: lint

* fix: test.sh
2024-05-25 14:51:20 -04:00
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