tty.go
This file
Path
internal/tty/tty.go
27 lines · 616 bytes · Go
Last changed by
chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e
History of this fileTake it
feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea
lines 1–5why, one step back1// Package tty provides tty-aware printing.2package tty34import (5 "fmt"chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e
line 6why, one step back6 "io"feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea
lines 7–9why, one step back7 "os"8 "sync"9chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e
line 10why, one step back10 "github.com/charmbracelet/colorprofile"feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea
lines 11–12why, one step back11)12chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e
lines 13–14why, one step back13var stdout = sync.OnceValue(func() io.Writer {14 return colorprofile.NewWriter(os.Stdout, os.Environ())feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea
lines 15–16why, one step back15})16chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e
lines 17–23why, one step back17// Writer returns a writer to stdout that downgrades or strips ansi18// sequences according to the environment (NO_COLOR, CLICOLOR, CLICOLOR_FORCE)19// and the capabilities of the terminal.20func Writer() io.Writer {21 return stdout()22}23feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea
lines 24–25why, one step back24// Println handles println, striping ansi sequences if stdout is not a tty.25func Println(s string) {chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e
line 26why, one step back26 _, _ = fmt.Fprintln(stdout(), s)feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea
line 27why, one step back27}