mirror of
https://github.com/charmbracelet/gum
synced 2024-06-20 06:25:08 +02:00
fix: isTTY & no new line
This commit is contained in:
parent
f048bd8d87
commit
6aac40560f
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/alecthomas/kong"
|
||||
"github.com/charmbracelet/bubbles/spinner"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/mattn/go-isatty"
|
||||
|
||||
"github.com/charmbracelet/gum/internal/exit"
|
||||
"github.com/charmbracelet/gum/style"
|
||||
|
@ -15,9 +16,7 @@ import (
|
|||
// Run provides a shell script interface for the spinner bubble.
|
||||
// https://github.com/charmbracelet/bubbles/spinner
|
||||
func (o Options) Run() error {
|
||||
var isTTY bool
|
||||
info, err := os.Stdout.Stat()
|
||||
isTTY = info.Mode()&os.ModeCharDevice == os.ModeCharDevice
|
||||
isTTY := isatty.IsTerminal(os.Stdout.Fd())
|
||||
|
||||
s := spinner.New()
|
||||
s.Style = o.SpinnerStyle.ToLipgloss()
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
|
||||
"github.com/charmbracelet/bubbles/spinner"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
type model struct {
|
||||
|
@ -84,7 +83,7 @@ func (m model) View() string {
|
|||
if !m.showOutput {
|
||||
return header
|
||||
}
|
||||
return lipgloss.JoinVertical(lipgloss.Top, header, errbuf.String(), outbuf.String())
|
||||
return header + errbuf.String() + "\n" + outbuf.String()
|
||||
}
|
||||
|
||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
|
Loading…
Reference in a new issue