fix: isTTY & no new line

This commit is contained in:
Maas Lalani 2023-06-27 10:36:33 -04:00
parent f048bd8d87
commit 6aac40560f
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000
2 changed files with 3 additions and 5 deletions

View file

@ -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()

View file

@ -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) {