Skip to content
Myr

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 file

Take it

feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea

lines 1–5why, one step back
1// Package tty provides tty-aware printing.
2package tty34import (5 "fmt"

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

line 6why, one step back
6 "io"

feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea

lines 7–9why, one step back
7 "os"
8 "sync"9

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

line 10why, one step back
10 "github.com/charmbracelet/colorprofile"

feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea

lines 11–12why, one step back
11)
12

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

lines 13–14why, one step back
13var 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 back
15})
16

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

lines 17–23why, one step back
17// Writer returns a writer to stdout that downgrades or strips ansi
18// 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}23

feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea

lines 24–25why, one step back
24// 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 back
26 _, _ = fmt.Fprintln(stdout(), s)

feat(filter): --select-if-one returns if single match (#778)Carlos Alexandro Beckerbefore adoption0e501ea

line 27why, one step back
27}