Documentation
¶
Index ¶
- Constants
- Variables
- func ColorProfile() termenv.Profile
- func FromCmdContext(ctx context.Context) (*cmdContext, bool)
- func NewOutput(w io.Writer, opts ...termenv.OutputOption) *termenv.Output
- func WithPrintTraceLink(ctx context.Context, printTraceLink bool) context.Context
- type Dump
- type Frontend
- type FrontendSpanExporter
- func (fe FrontendSpanExporter) Background(cmd tea.ExecCommand) error
- func (fe FrontendSpanExporter) Close() error
- func (fe FrontendSpanExporter) ConnectedToEngine(ctx context.Context, name string, version string, clientID string)
- func (fe FrontendSpanExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error
- func (fe FrontendSpanExporter) ForceFlush(context.Context) error
- func (fe FrontendSpanExporter) Init() tea.Cmd
- func (fe FrontendSpanExporter) LogExporter() sdklog.Exporter
- func (fe FrontendSpanExporter) Render(out *termenv.Output) error
- func (fe FrontendSpanExporter) Run(ctx context.Context, opts dagui.FrontendOpts, run func(context.Context) error) error
- func (fe FrontendSpanExporter) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (fe FrontendSpanExporter) SetPrimary(spanID trace.SpanID)
- func (fe FrontendSpanExporter) SetRevealAllSpans(val bool)
- func (fe FrontendSpanExporter) Shutdown(ctx context.Context) error
- func (fe FrontendSpanExporter) SpanExporter() sdktrace.SpanExporter
- func (fe FrontendSpanExporter) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (fe FrontendSpanExporter) View() string
- type Vterm
- func (term *Vterm) Init() tea.Cmd
- func (term *Vterm) LastLine() string
- func (term *Vterm) Print(w io.Writer) error
- func (term *Vterm) Render(w io.Writer, offset, height int)
- func (term *Vterm) ScrollPercent() float64
- func (term *Vterm) SetHeight(height int)
- func (term *Vterm) SetPrefix(prefix string)
- func (term *Vterm) SetWidth(width int)
- func (term *Vterm) Term() *midterm.Terminal
- func (term *Vterm) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (term *Vterm) UsedHeight() int
- func (term *Vterm) View() string
- func (term *Vterm) Write(p []byte) (int, error)
Constants ¶
const ( Block = "█" CaretDownEmpty = "▽" CaretDownFilled = "▼" CaretLeftFilled = "◀" // "<" CaretRightEmpty = "▷" // ">" CaretRightFilled = "▶" // ">" CornerBottomLeft = "╰" CornerBottomRight = "╯" CornerTopLeft = "╭" CornerTopRight = "╮" CrossBar = "┼" DotEmpty = "○" DotFilled = "●" HorizBar = "─" HorizBottomBar = "┬" HorizHalfLeftBar = "╴" HorizHalfRightBar = "╶" HorizTopBar = "┴" HorizTopBoldBar = "┻" InactiveGroupSymbol = VertBar TaskSymbol = VertRightBoldBar VertBar = "│" VertBoldBar = "┃" VertDottedBar = "┊" // ┊┆┇┋╎ VertLeftBar = "┤" VertLeftBoldBar = "┫" VertRightBar = "├" VertRightBoldBar = "┣" IconSkipped = "∅" IconSuccess = "✔" IconFailure = "✘" )
Variables ¶
var KeymapStyle = lipgloss.NewStyle(). Foreground(lipgloss.ANSIColor(termenv.ANSIBrightBlack))
Functions ¶
func ColorProfile ¶ added in v0.11.1
ColorProfile returns Ascii if, and only if, NO_COLOR or similar is set. Otherwise it returns termenv.ANSI, allowing colors to be used.
Note that color profiles beyond simple ANSI are not used by Progrock. 16 colors is all you need. Anything else disrespects the user's color scheme preferences.
func FromCmdContext ¶ added in v0.13.0
func NewOutput ¶ added in v0.11.1
NewOutput returns a termenv.Output that will always use color, regardless of whether w is a TTY, unless NO_COLOR is explicitly set.
Progrock is opinionated here. Termenv disables colors by default if stdout is not a TTY or if the CI env var is set. We don't want that, because folks deserve colorful output in CI too.
To disable colors, set NO_COLOR (https://no-color.org/).
Types ¶
type Frontend ¶
type Frontend interface {
// Run starts a frontend, and runs the target function.
Run(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) error) error
// SetPrimary tells the frontend which span should be treated like the focal
// point of the command. Its output will be displayed at the end, and its
// children will be promoted to the "top-level" of the TUI.
SetPrimary(spanID trace.SpanID)
Background(cmd tea.ExecCommand) error
// RevealAllSpans tells the frontend to show all spans, not just the spans
// beneath the primary span.
SetRevealAllSpans(bool)
// Can consume otel spans and logs.
SpanExporter() sdktrace.SpanExporter
LogExporter() sdklog.Exporter
// ConnectedToEngine is called when the CLI connects to an engine.
ConnectedToEngine(ctx context.Context, name string, version string, clientID string)
// SetCloudURL is called after the CLI checks auth and sets the cloud URL.
SetCloudURL(ctx context.Context, url string, msg string, logged bool)
}
type FrontendSpanExporter ¶ added in v0.11.7
type FrontendSpanExporter struct {
// contains filtered or unexported fields
}
func (FrontendSpanExporter) Background ¶ added in v0.11.7
func (fe FrontendSpanExporter) Background(cmd tea.ExecCommand) error
func (FrontendSpanExporter) ConnectedToEngine ¶ added in v0.11.7
func (FrontendSpanExporter) ExportSpans ¶ added in v0.11.7
func (fe FrontendSpanExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error
func (FrontendSpanExporter) ForceFlush ¶ added in v0.11.7
func (FrontendSpanExporter) LogExporter ¶ added in v0.11.7
func (FrontendSpanExporter) Run ¶ added in v0.11.7
func (fe FrontendSpanExporter) Run(ctx context.Context, opts dagui.FrontendOpts, run func(context.Context) error) error
Run starts the TUI, calls the run function, stops the TUI, and finally prints the primary output to the appropriate stdout/stderr streams.
func (FrontendSpanExporter) SetCloudURL ¶ added in v0.12.0
func (FrontendSpanExporter) SetPrimary ¶ added in v0.11.7
func (FrontendSpanExporter) SetRevealAllSpans ¶ added in v0.12.5
func (fe FrontendSpanExporter) SetRevealAllSpans(val bool)
func (FrontendSpanExporter) SpanExporter ¶ added in v0.11.7
func (fe FrontendSpanExporter) SpanExporter() sdktrace.SpanExporter
type Vterm ¶ added in v0.9.9
type Vterm struct {
Offset int
Height int
Width int
Prefix string
// contains filtered or unexported fields
}
func (*Vterm) LastLine ¶ added in v0.9.9
LastLine returns the last line of visible text, with ANSI formatting, but without any trailing whitespace.
func (*Vterm) Render ¶ added in v0.9.9
Bytes returns the output for the given region of the terminal, with ANSI formatting.