Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] add option for gum spin to dump output on error #55

Closed
jackmac92 opened this issue Jul 31, 2022 · 7 comments · Fixed by #518
Closed

[feature request] add option for gum spin to dump output on error #55

jackmac92 opened this issue Jul 31, 2022 · 7 comments · Fixed by #518
Labels
enhancement New feature or request

Comments

@jackmac92
Copy link

I think it would be great if gum spin could act as a prettier version of chronic, which hides the output unless an error occurs

@maaslalani
Copy link
Member

maaslalani commented Aug 1, 2022

Hey @jackmac92, I think this is a really great idea. Let me/us think a little bit more about it / how to implement it (default behaviour vs opt-in, etc...).

Thanks for sharing the chronic tool, btw!

@maaslalani
Copy link
Member

maaslalani commented Aug 1, 2022

Also, if you want a quick and dirty version of this functionality while we think about it, you can do this (on gum HEAD)

gum spin --show-output -- <command> >/dev/null

This will only display the stderr and not the stdout which should generally only output errors and be quiet if there are no errors

@chrisfromredfin
Copy link

I'm piggybacking a little, but I'm realizing that this is close to what I want. I want to display a gum spinner while I run a long-running process whose output I want/need. That is, I'm trying something like:

gum spin -s points --title "Fetching list of sites..." -- someLongCommand > output.txt

What I really want is to display a spinner while someLongCommand writes its output to a file. So, would there perhaps be a flag to also allow the output to pass through? Or to add a --output-to-file option or something?

@maaslalani
Copy link
Member

@chrisfromredfin That should work but you need to use the --show-output to redirect the output to the file (also make sure you're on the latest version of gum)

@chrisfromredfin
Copy link

chrisfromredfin commented Aug 26, 2022 via email

@maaslalani
Copy link
Member

maaslalani commented Aug 27, 2022

Ah sorry, I think the change that fixes this is not on v0.4.0.

@chrisfromredfin I think if you build on the latest code (including this commit: 4e61c12), the spinner will not be included in the file.

We will likely make a new release soon.

@chrisfromredfin
Copy link

Yes, just confirming that with a HEAD build it works! Excited for a new release. :)

@muesli muesli added the enhancement New feature or request label Oct 5, 2022
elliotcourant added a commit to elliotcourant/gum that referenced this issue Oct 14, 2023
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 charmbracelet#371

Resolves charmbracelet#55
pingiun pushed a commit to pingiun/gum that referenced this issue Mar 27, 2024
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 charmbracelet#371

Resolves charmbracelet#55
maaslalani pushed a commit that referenced this issue Mar 28, 2024
… (#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 #371

Resolves #55

* chore: Fix formatting

---------

Co-authored-by: Elliot Courant <me@elliotcourant.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants