Documentation
¶
Overview ¶
Package idtui provides terminal user interface frontends for Dagger operations. This file contains the dots-style frontend that provides minimal, colorized output with green dots for successful operations and red X's for failures.
Index ¶
- Constants
- Variables
- func ColorProfile() termenv.Profile
- func FromCmdContext(ctx context.Context) (*cmdContext, bool)
- func HasDarkBackground() bool
- func KeyEnabled(enabled bool) key.BindingOpt
- func NewForm(groups ...*huh.Group) *huh.Form
- func NewOutput(w io.Writer, opts ...termenv.OutputOption) *termenv.Output
- func NewWithDB(w io.Writer, db *dagui.DB) *frontendPretty
- func RegisterFieldRenderer(fieldName string, rendererFactory func() FieldRenderer)
- func TTYStyle() *chroma.Style
- func WithPrintTraceLink(ctx context.Context, printTraceLink bool) context.Context
- type AdaptiveColor
- type ContextDirectoryArgs
- type Dump
- type ExitError
- type FieldRenderer
- type Frontend
- type FrontendMetricExporter
- func (fe FrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
- func (fe FrontendMetricExporter) Background(cmd tea.ExecCommand, raw bool) error
- func (fe FrontendMetricExporter) Close() error
- func (fe FrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
- func (fe FrontendMetricExporter) FinalRender(w io.Writer) error
- func (fe FrontendMetricExporter) ForceFlush(context.Context) error
- func (fe FrontendMetricExporter) HandleForm(ctx context.Context, form *huh.Form) error
- func (fe FrontendMetricExporter) HandlePrompt(ctx context.Context, title, prompt string, dest any) error
- func (fe FrontendMetricExporter) Init() tea.Cmd
- func (fe FrontendMetricExporter) LogExporter() sdklog.Exporter
- func (fe FrontendMetricExporter) MetricExporter() sdkmetric.Exporter
- func (fe FrontendMetricExporter) Opts() *dagui.FrontendOpts
- func (fe FrontendMetricExporter) Render(out TermOutput) error
- func (fe FrontendMetricExporter) RevealAllSpans()
- func (fe FrontendMetricExporter) Run(ctx context.Context, opts dagui.FrontendOpts, ...) error
- func (fe FrontendMetricExporter) SetClient(client *dagger.Client)
- func (fe FrontendMetricExporter) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (fe FrontendMetricExporter) SetPrimary(spanID dagui.SpanID)
- func (fe FrontendMetricExporter) SetSidebarContent(section SidebarSection)
- func (fe FrontendMetricExporter) SetVerbosity(n int)
- func (fe FrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
- func (fe FrontendMetricExporter) Shutdown(ctx context.Context) error
- func (fe FrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
- func (fe FrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
- func (fe FrontendMetricExporter) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (fe FrontendMetricExporter) View() string
- type FrontendMock
- func (mock *FrontendMock) Background(cmd tea.ExecCommand, raw bool) error
- func (mock *FrontendMock) BackgroundCalls() []struct{ ... }
- func (mock *FrontendMock) HandleForm(ctx context.Context, form *huh.Form) error
- func (mock *FrontendMock) HandleFormCalls() []struct{ ... }
- func (mock *FrontendMock) HandlePrompt(ctx context.Context, title string, prompt string, dest any) error
- func (mock *FrontendMock) HandlePromptCalls() []struct{ ... }
- func (mock *FrontendMock) LogExporter() sdklog.Exporter
- func (mock *FrontendMock) LogExporterCalls() []struct{}
- func (mock *FrontendMock) MetricExporter() sdkmetric.Exporter
- func (mock *FrontendMock) MetricExporterCalls() []struct{}
- func (mock *FrontendMock) Opts() *dagui.FrontendOpts
- func (mock *FrontendMock) OptsCalls() []struct{}
- func (mock *FrontendMock) RevealAllSpans()
- func (mock *FrontendMock) RevealAllSpansCalls() []struct{}
- func (mock *FrontendMock) Run(ctx context.Context, opts dagui.FrontendOpts, ...) error
- func (mock *FrontendMock) RunCalls() []struct{ ... }
- func (mock *FrontendMock) SetClient(client *dagger.Client)
- func (mock *FrontendMock) SetClientCalls() []struct{ ... }
- func (mock *FrontendMock) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (mock *FrontendMock) SetCloudURLCalls() []struct{ ... }
- func (mock *FrontendMock) SetPrimary(spanID dagui.SpanID)
- func (mock *FrontendMock) SetPrimaryCalls() []struct{ ... }
- func (mock *FrontendMock) SetSidebarContent(sidebarSection SidebarSection)
- func (mock *FrontendMock) SetSidebarContentCalls() []struct{ ... }
- func (mock *FrontendMock) SetVerbosity(n int)
- func (mock *FrontendMock) SetVerbosityCalls() []struct{ ... }
- func (mock *FrontendMock) Shell(ctx context.Context, handler ShellHandler)
- func (mock *FrontendMock) ShellCalls() []struct{ ... }
- func (mock *FrontendMock) SpanExporter() sdktrace.SpanExporter
- func (mock *FrontendMock) SpanExporterCalls() []struct{}
- type Markdown
- type PatchPreview
- type PlainFrontendMetricExporter
- func (fe PlainFrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
- func (fe PlainFrontendMetricExporter) Background(cmd tea.ExecCommand, raw bool) error
- func (fe PlainFrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
- func (fe PlainFrontendMetricExporter) ForceFlush(context.Context) error
- func (fe PlainFrontendMetricExporter) HandleForm(ctx context.Context, form *huh.Form) error
- func (fe PlainFrontendMetricExporter) HandlePrompt(ctx context.Context, _, prompt string, dest any) error
- func (fe PlainFrontendMetricExporter) LogExporter() sdklog.Exporter
- func (fe PlainFrontendMetricExporter) MetricExporter() sdkmetric.Exporter
- func (fe PlainFrontendMetricExporter) Opts() *dagui.FrontendOpts
- func (fe PlainFrontendMetricExporter) RevealAllSpans()
- func (fe PlainFrontendMetricExporter) Run(ctx context.Context, opts dagui.FrontendOpts, ...) error
- func (fe PlainFrontendMetricExporter) SetClient(client *dagger.Client)
- func (fe PlainFrontendMetricExporter) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (fe PlainFrontendMetricExporter) SetPrimary(spanID dagui.SpanID)
- func (fe PlainFrontendMetricExporter) SetSidebarContent(SidebarSection)
- func (fe PlainFrontendMetricExporter) SetVerbosity(n int)
- func (fe PlainFrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
- func (fe PlainFrontendMetricExporter) Shutdown(ctx context.Context) error
- func (fe PlainFrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
- func (fe PlainFrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
- type Rave
- func (rave *Rave) Init() tea.Cmd
- func (rave *Rave) Progress(now time.Time) (int, float64)
- func (rave *Rave) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (rave *Rave) View() string
- func (rave *Rave) ViewFancy(now time.Time) string
- func (rave *Rave) ViewFrame(now time.Time, frames SpinnerFrames) (string, int)
- type ShellHandler
- type SidebarSection
- type Spinner
- type SpinnerFrames
- type TermOutput
- type UpdatePromptMsg
- 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)
- func (term *Vterm) WriteMarkdown(p []byte) (int, error)
- type WithDirectoryArgs
- type WithEnvVariableArgs
- type WithExecArgs
- type WithFileArgs
- type WithMountedDirectoryArgs
- type WithMountedFileArgs
- type WithNewFileArgs
- type WithUserArgs
- type WithWorkdirArgs
Constants ¶
const ( Block = "█" Block75 = "▓" Block50 = "▒" Block25 = "░" CaretDownEmpty = "▽" CaretDownFilled = "▼" CaretLeftFilled = "◀" // "<" CaretRightEmpty = "▷" // ">" CaretRightFilled = "▶" // ">" CornerBottomLeft = "╰" CornerBottoRight = "╯" CornerTopLeft = "╭" CornerTopRight = "╮" CrossBar = "┼" DotEmpty = "○" DotHalf = "◐" DotFilled = "●" DotCenter = "◉" DotTiny = "·" HorizBar = "─" HorizBottomBar = "┬" HorizHalfLeftBar = "╴" HorizHalfRightBar = "╶" HorizTopBar = "┴" HorizTopBoldBar = "┻" InactiveGroupSymbol = VertBar TaskSymbol = VertRightBoldBar VertBar = "│" VertBoldBar = "┃" VertDash2 = "╎" VertDash3 = "┆" VertBoldDash3 = "┇" VertDash4 = "┊" VertBoldDash4 = "┋" VertLeftBar = "┤" VertLeftBoldBar = "┫" VertRightBar = "├" VertRightBoldBar = "┣" IconSkipped = "∅" IconSuccess = "✔" IconFailure = "✘" IconCached = "$" // cache money Diamond = "◆" LLMPrompt = "❯" BorderLeft = "▕" CloudIcon = "⬢" // We need a prompt that conveys the unique nature of the Dagger shell. Per gpt4: // The ⋈ symbol, known as the bowtie, has deep roots in relational databases and set theory, // where it denotes a join operation. This makes it especially fitting for a DAG environment, // as it suggests the idea of dependencies, intersections, and points where separate paths // or data sets come together. ShellPrompt = "⋈" )
const DefaultBPM = 123
DefaultBPM is a sane default of 123 beats per minute.
Variables ¶
var ( ErrShellExited = errors.New("shell exited") ErrInterrupted = errors.New("interrupted") )
var ( ANSIBlack = lipgloss.Color("0") ANSIRed = lipgloss.Color("1") ANSIGreen = lipgloss.Color("2") ANSIYellow = lipgloss.Color("3") ANSIBlue = lipgloss.Color("4") ANSIMagenta = lipgloss.Color("5") ANSICyan = lipgloss.Color("6") ANSIWhite = lipgloss.Color("7") ANSIBrightBlack = lipgloss.Color("8") ANSIBrightRed = lipgloss.Color("9") ANSIBrightGreen = lipgloss.Color("10") ANSIBrightYellow = lipgloss.Color("11") ANSIBrightBlue = lipgloss.Color("12") ANSIBrightMagenta = lipgloss.Color("13") ANSIBrightCyan = lipgloss.Color("14") ANSIBrightWhite = lipgloss.Color("15") )
var DotFrames = SpinnerFrames{ []string{"⣾", "⣷", "⣧", "⣏", "⡟", "⡿", "⢿", "⢻", "⣹", "⣼"}, ease.Linear, }
var FadeFrames = SpinnerFrames{ []string{"█", "█", "▓", "▓", "▒", "▒", "░", "░", " ", " "}, ease.InCubic, }
var Fail = ExitError{Code: 1}
var FieldRendererRegistry = map[string]func() FieldRenderer{ "withExec": func() FieldRenderer { return &WithExecArgs{} }, "withWorkdir": func() FieldRenderer { return &WithWorkdirArgs{} }, "withEnvVariable": func() FieldRenderer { return &WithEnvVariableArgs{} }, "withMountedDirectory": func() FieldRenderer { return &WithMountedDirectoryArgs{} }, "withMountedFile": func() FieldRenderer { return &WithMountedFileArgs{} }, "withDirectory": func() FieldRenderer { return &WithDirectoryArgs{} }, "withFile": func() FieldRenderer { return &WithFileArgs{} }, "withNewFile": func() FieldRenderer { return &WithNewFileArgs{} }, "withUser": func() FieldRenderer { return &WithUserArgs{} }, "_contextDirectory": func() FieldRenderer { return &ContextDirectoryArgs{} }, }
FieldRendererRegistry holds all field renderers. Each entry maps a GraphQL field name to a factory function that creates a new renderer instance.
var KeymapStyle = lipgloss.NewStyle(). Foreground(lipgloss.ANSIColor(termenv.ANSIBrightBlack))
var MarkdownStyle = styles.LightStyleConfig
var MeterFrames = SpinnerFrames{ []string{"█", "█", "▇", "▆", "▅", "▄", "▃", "▂", "▁", " "}, ease.InOutCubic, }
var MiniDotFrames = SpinnerFrames{ []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, ease.Linear, }
var SkipLoggedOutTraceMsgEnvs = []string{
"DAGGER_NO_NAG",
"NOTHANKS", "SHUTUP", "GOAWAY", "STOPIT",
}
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 HasDarkBackground ¶ added in v0.17.0
func HasDarkBackground() bool
func KeyEnabled ¶ added in v0.17.0
func KeyEnabled(enabled bool) key.BindingOpt
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/).
func RegisterFieldRenderer ¶ added in v0.19.7
func RegisterFieldRenderer(fieldName string, rendererFactory func() FieldRenderer)
RegisterFieldRenderer adds a new field renderer to the registry
Types ¶
type AdaptiveColor ¶ added in v0.17.0
func (AdaptiveColor) Sequence ¶ added in v0.17.0
func (c AdaptiveColor) Sequence(bg bool) string
type ContextDirectoryArgs ¶ added in v0.19.7
type ContextDirectoryArgs struct {
Path string `json:"path"`
Exclude []string `json:"exclude"`
Module string `json:"module"`
Digest string `json:"digest"`
}
ContextDirectoryArgs represents the arguments for withUser calls
func (ContextDirectoryArgs) Render ¶ added in v0.19.7
func (a ContextDirectoryArgs) Render(out TermOutput) (string, []string, bool)
type ExitError ¶ added in v0.19.7
type ExitError struct {
Code int
// An optional originating error, for any code paths that go looking for it,
// e.g. telemetry.EndWithCause which looks for and applies error origins.
Original error
}
ExitError is an error that indicates a command should exit with a specific status code, without printing an error message, assuming a human readable message has been printed already.
It is basically a shortcut for `os.Exit` while giving the TUI a chance to exit gracefully and flush output.
type FieldRenderer ¶ added in v0.19.7
type FieldRenderer interface {
// Render processes the call and returns title text and args to elide from normal rendering
Render(out TermOutput) (title string, elidedArgs []string, specialTitle bool)
}
FieldRenderer defines how to render a specific GraphQL field call
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) (cleanups.CleanupF, error)) error
// Opts returns the opts of the currently running frontend.
Opts() *dagui.FrontendOpts
SetVerbosity(n int)
// 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 dagui.SpanID)
Background(cmd tea.ExecCommand, raw bool) error
// RevealAllSpans tells the frontend to show all spans, not just
// the spans beneath the primary span.
RevealAllSpans()
// Can consume otel spans, logs and metrics.
SpanExporter() sdktrace.SpanExporter
LogExporter() sdklog.Exporter
MetricExporter() sdkmetric.Exporter
// SetCloudURL is called after the CLI checks auth and sets the cloud URL.
SetCloudURL(ctx context.Context, url string, msg string, logged bool)
// SetClient is called to notify the frontend of a created dagger client.
// This can be used to make requests to the engine for more information.
SetClient(*dagger.Client)
// Shell is called when the CLI enters interactive mode.
Shell(ctx context.Context, handler ShellHandler)
// Populate the sidebar with content.
SetSidebarContent(SidebarSection)
prompt.PromptHandler
}
func NewDots ¶ added in v0.18.11
NewDots creates a new dots-style frontend that outputs green dots for successful spans and red X's for failed spans. This frontend is ideal for console/non-TTY environments where you want minimal, clear feedback about operation progress without verbose output.
Output format:
- Green dots (.) for successful operations
- Red X's (X) for failed operations
- Newline printed at the end when shutting down
This frontend does not support interactive features like shell or prompts.
func NewReporter ¶ added in v0.15.0
type FrontendMetricExporter ¶ added in v0.13.6
type FrontendMetricExporter struct {
// contains filtered or unexported fields
}
func (FrontendMetricExporter) Aggregation ¶ added in v0.13.6
func (fe FrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
func (FrontendMetricExporter) Background ¶ added in v0.13.6
func (fe FrontendMetricExporter) Background(cmd tea.ExecCommand, raw bool) error
func (FrontendMetricExporter) Close ¶ added in v0.13.6
func (fe FrontendMetricExporter) Close() error
func (FrontendMetricExporter) Export ¶ added in v0.13.6
func (fe FrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
func (FrontendMetricExporter) FinalRender ¶ added in v0.15.0
FinalRender is called after the program has finished running and prints the final output after the TUI has exited.
func (FrontendMetricExporter) ForceFlush ¶ added in v0.13.6
func (fe FrontendMetricExporter) ForceFlush(context.Context) error
func (FrontendMetricExporter) HandleForm ¶ added in v0.18.18
func (FrontendMetricExporter) HandlePrompt ¶ added in v0.17.0
func (FrontendMetricExporter) LogExporter ¶ added in v0.13.6
func (FrontendMetricExporter) MetricExporter ¶ added in v0.13.6
func (FrontendMetricExporter) Opts ¶ added in v0.13.6
func (fe FrontendMetricExporter) Opts() *dagui.FrontendOpts
func (FrontendMetricExporter) Render ¶ added in v0.13.6
func (fe FrontendMetricExporter) Render(out TermOutput) error
func (FrontendMetricExporter) RevealAllSpans ¶ added in v0.15.0
func (fe FrontendMetricExporter) RevealAllSpans()
func (FrontendMetricExporter) Run ¶ added in v0.13.6
func (fe FrontendMetricExporter) Run(ctx context.Context, opts dagui.FrontendOpts, run func(context.Context) (cleanups.CleanupF, 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 (FrontendMetricExporter) SetCloudURL ¶ added in v0.13.6
func (FrontendMetricExporter) SetPrimary ¶ added in v0.13.6
func (FrontendMetricExporter) SetSidebarContent ¶ added in v0.19.0
func (fe FrontendMetricExporter) SetSidebarContent(section SidebarSection)
func (FrontendMetricExporter) SetVerbosity ¶ added in v0.15.3
func (fe FrontendMetricExporter) SetVerbosity(n int)
func (FrontendMetricExporter) Shell ¶ added in v0.16.3
func (fe FrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
func (FrontendMetricExporter) SpanExporter ¶ added in v0.13.6
func (fe FrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
func (FrontendMetricExporter) Temporality ¶ added in v0.13.6
func (fe FrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
type FrontendMock ¶ added in v0.19.4
type FrontendMock struct {
// BackgroundFunc mocks the Background method.
BackgroundFunc func(cmd tea.ExecCommand, raw bool) error
// HandleFormFunc mocks the HandleForm method.
HandleFormFunc func(ctx context.Context, form *huh.Form) error
// HandlePromptFunc mocks the HandlePrompt method.
HandlePromptFunc func(ctx context.Context, title string, prompt string, dest any) error
// LogExporterFunc mocks the LogExporter method.
LogExporterFunc func() sdklog.Exporter
// MetricExporterFunc mocks the MetricExporter method.
MetricExporterFunc func() sdkmetric.Exporter
// OptsFunc mocks the Opts method.
OptsFunc func() *dagui.FrontendOpts
// RevealAllSpansFunc mocks the RevealAllSpans method.
RevealAllSpansFunc func()
// RunFunc mocks the Run method.
RunFunc func(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) (cleanups.CleanupF, error)) error
// SetClientFunc mocks the SetClient method.
SetClientFunc func(client *dagger.Client)
// SetCloudURLFunc mocks the SetCloudURL method.
SetCloudURLFunc func(ctx context.Context, url string, msg string, logged bool)
// SetPrimaryFunc mocks the SetPrimary method.
SetPrimaryFunc func(spanID dagui.SpanID)
// SetSidebarContentFunc mocks the SetSidebarContent method.
SetSidebarContentFunc func(sidebarSection SidebarSection)
// SetVerbosityFunc mocks the SetVerbosity method.
SetVerbosityFunc func(n int)
// ShellFunc mocks the Shell method.
ShellFunc func(ctx context.Context, handler ShellHandler)
// SpanExporterFunc mocks the SpanExporter method.
SpanExporterFunc func() sdktrace.SpanExporter
// contains filtered or unexported fields
}
FrontendMock is a mock implementation of Frontend.
func TestSomethingThatUsesFrontend(t *testing.T) {
// make and configure a mocked Frontend
mockedFrontend := &FrontendMock{
BackgroundFunc: func(cmd tea.ExecCommand, raw bool) error {
panic("mock out the Background method")
},
HandleFormFunc: func(ctx context.Context, form *huh.Form) error {
panic("mock out the HandleForm method")
},
HandlePromptFunc: func(ctx context.Context, title string, prompt string, dest any) error {
panic("mock out the HandlePrompt method")
},
LogExporterFunc: func() sdklog.Exporter {
panic("mock out the LogExporter method")
},
MetricExporterFunc: func() sdkmetric.Exporter {
panic("mock out the MetricExporter method")
},
OptsFunc: func() *dagui.FrontendOpts {
panic("mock out the Opts method")
},
RevealAllSpansFunc: func() {
panic("mock out the RevealAllSpans method")
},
RunFunc: func(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) (cleanups.CleanupF, error)) error {
panic("mock out the Run method")
},
SetClientFunc: func(client *dagger.Client) {
panic("mock out the SetClient method")
},
SetCloudURLFunc: func(ctx context.Context, url string, msg string, logged bool) {
panic("mock out the SetCloudURL method")
},
SetPrimaryFunc: func(spanID dagui.SpanID) {
panic("mock out the SetPrimary method")
},
SetSidebarContentFunc: func(sidebarSection SidebarSection) {
panic("mock out the SetSidebarContent method")
},
SetVerbosityFunc: func(n int) {
panic("mock out the SetVerbosity method")
},
ShellFunc: func(ctx context.Context, handler ShellHandler) {
panic("mock out the Shell method")
},
SpanExporterFunc: func() sdktrace.SpanExporter {
panic("mock out the SpanExporter method")
},
}
// use mockedFrontend in code that requires Frontend
// and then make assertions.
}
func (*FrontendMock) Background ¶ added in v0.19.4
func (mock *FrontendMock) Background(cmd tea.ExecCommand, raw bool) error
Background calls BackgroundFunc.
func (*FrontendMock) BackgroundCalls ¶ added in v0.19.4
func (mock *FrontendMock) BackgroundCalls() []struct { Cmd tea.ExecCommand Raw bool }
BackgroundCalls gets all the calls that were made to Background. Check the length with:
len(mockedFrontend.BackgroundCalls())
func (*FrontendMock) HandleForm ¶ added in v0.19.4
HandleForm calls HandleFormFunc.
func (*FrontendMock) HandleFormCalls ¶ added in v0.19.4
func (mock *FrontendMock) HandleFormCalls() []struct { Ctx context.Context Form *huh.Form }
HandleFormCalls gets all the calls that were made to HandleForm. Check the length with:
len(mockedFrontend.HandleFormCalls())
func (*FrontendMock) HandlePrompt ¶ added in v0.19.4
func (mock *FrontendMock) HandlePrompt(ctx context.Context, title string, prompt string, dest any) error
HandlePrompt calls HandlePromptFunc.
func (*FrontendMock) HandlePromptCalls ¶ added in v0.19.4
func (mock *FrontendMock) HandlePromptCalls() []struct { Ctx context.Context Title string Prompt string Dest any }
HandlePromptCalls gets all the calls that were made to HandlePrompt. Check the length with:
len(mockedFrontend.HandlePromptCalls())
func (*FrontendMock) LogExporter ¶ added in v0.19.4
func (mock *FrontendMock) LogExporter() sdklog.Exporter
LogExporter calls LogExporterFunc.
func (*FrontendMock) LogExporterCalls ¶ added in v0.19.4
func (mock *FrontendMock) LogExporterCalls() []struct { }
LogExporterCalls gets all the calls that were made to LogExporter. Check the length with:
len(mockedFrontend.LogExporterCalls())
func (*FrontendMock) MetricExporter ¶ added in v0.19.4
func (mock *FrontendMock) MetricExporter() sdkmetric.Exporter
MetricExporter calls MetricExporterFunc.
func (*FrontendMock) MetricExporterCalls ¶ added in v0.19.4
func (mock *FrontendMock) MetricExporterCalls() []struct { }
MetricExporterCalls gets all the calls that were made to MetricExporter. Check the length with:
len(mockedFrontend.MetricExporterCalls())
func (*FrontendMock) Opts ¶ added in v0.19.4
func (mock *FrontendMock) Opts() *dagui.FrontendOpts
Opts calls OptsFunc.
func (*FrontendMock) OptsCalls ¶ added in v0.19.4
func (mock *FrontendMock) OptsCalls() []struct { }
OptsCalls gets all the calls that were made to Opts. Check the length with:
len(mockedFrontend.OptsCalls())
func (*FrontendMock) RevealAllSpans ¶ added in v0.19.4
func (mock *FrontendMock) RevealAllSpans()
RevealAllSpans calls RevealAllSpansFunc.
func (*FrontendMock) RevealAllSpansCalls ¶ added in v0.19.4
func (mock *FrontendMock) RevealAllSpansCalls() []struct { }
RevealAllSpansCalls gets all the calls that were made to RevealAllSpans. Check the length with:
len(mockedFrontend.RevealAllSpansCalls())
func (*FrontendMock) Run ¶ added in v0.19.4
func (mock *FrontendMock) Run(ctx context.Context, opts dagui.FrontendOpts, f func(context.Context) (cleanups.CleanupF, error)) error
Run calls RunFunc.
func (*FrontendMock) RunCalls ¶ added in v0.19.4
func (mock *FrontendMock) RunCalls() []struct { Ctx context.Context Opts dagui.FrontendOpts F func(context.Context) (cleanups.CleanupF, error) }
RunCalls gets all the calls that were made to Run. Check the length with:
len(mockedFrontend.RunCalls())
func (*FrontendMock) SetClient ¶ added in v0.19.4
func (mock *FrontendMock) SetClient(client *dagger.Client)
SetClient calls SetClientFunc.
func (*FrontendMock) SetClientCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetClientCalls() []struct { Client *dagger.Client }
SetClientCalls gets all the calls that were made to SetClient. Check the length with:
len(mockedFrontend.SetClientCalls())
func (*FrontendMock) SetCloudURL ¶ added in v0.19.4
SetCloudURL calls SetCloudURLFunc.
func (*FrontendMock) SetCloudURLCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetCloudURLCalls() []struct { Ctx context.Context URL string Msg string Logged bool }
SetCloudURLCalls gets all the calls that were made to SetCloudURL. Check the length with:
len(mockedFrontend.SetCloudURLCalls())
func (*FrontendMock) SetPrimary ¶ added in v0.19.4
func (mock *FrontendMock) SetPrimary(spanID dagui.SpanID)
SetPrimary calls SetPrimaryFunc.
func (*FrontendMock) SetPrimaryCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetPrimaryCalls() []struct { SpanID dagui.SpanID }
SetPrimaryCalls gets all the calls that were made to SetPrimary. Check the length with:
len(mockedFrontend.SetPrimaryCalls())
func (*FrontendMock) SetSidebarContent ¶ added in v0.19.4
func (mock *FrontendMock) SetSidebarContent(sidebarSection SidebarSection)
SetSidebarContent calls SetSidebarContentFunc.
func (*FrontendMock) SetSidebarContentCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetSidebarContentCalls() []struct { SidebarSection SidebarSection }
SetSidebarContentCalls gets all the calls that were made to SetSidebarContent. Check the length with:
len(mockedFrontend.SetSidebarContentCalls())
func (*FrontendMock) SetVerbosity ¶ added in v0.19.4
func (mock *FrontendMock) SetVerbosity(n int)
SetVerbosity calls SetVerbosityFunc.
func (*FrontendMock) SetVerbosityCalls ¶ added in v0.19.4
func (mock *FrontendMock) SetVerbosityCalls() []struct { N int }
SetVerbosityCalls gets all the calls that were made to SetVerbosity. Check the length with:
len(mockedFrontend.SetVerbosityCalls())
func (*FrontendMock) Shell ¶ added in v0.19.4
func (mock *FrontendMock) Shell(ctx context.Context, handler ShellHandler)
Shell calls ShellFunc.
func (*FrontendMock) ShellCalls ¶ added in v0.19.4
func (mock *FrontendMock) ShellCalls() []struct { Ctx context.Context Handler ShellHandler }
ShellCalls gets all the calls that were made to Shell. Check the length with:
len(mockedFrontend.ShellCalls())
func (*FrontendMock) SpanExporter ¶ added in v0.19.4
func (mock *FrontendMock) SpanExporter() sdktrace.SpanExporter
SpanExporter calls SpanExporterFunc.
func (*FrontendMock) SpanExporterCalls ¶ added in v0.19.4
func (mock *FrontendMock) SpanExporterCalls() []struct { }
SpanExporterCalls gets all the calls that were made to SpanExporter. Check the length with:
len(mockedFrontend.SpanExporterCalls())
type Markdown ¶ added in v0.17.0
type PatchPreview ¶ added in v0.19.1
type PatchPreview struct {
Patch *diffparser.Diff
AddedDirs []string
RemovedDirs []string
}
func PreviewPatch ¶ added in v0.19.1
type PlainFrontendMetricExporter ¶ added in v0.13.6
type PlainFrontendMetricExporter struct {
// contains filtered or unexported fields
}
func (PlainFrontendMetricExporter) Aggregation ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Aggregation(ik sdkmetric.InstrumentKind) sdkmetric.Aggregation
func (PlainFrontendMetricExporter) Background ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Background(cmd tea.ExecCommand, raw bool) error
func (PlainFrontendMetricExporter) Export ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
func (PlainFrontendMetricExporter) ForceFlush ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) ForceFlush(context.Context) error
func (PlainFrontendMetricExporter) HandleForm ¶ added in v0.18.18
func (PlainFrontendMetricExporter) HandlePrompt ¶ added in v0.17.0
func (PlainFrontendMetricExporter) LogExporter ¶ added in v0.13.6
func (PlainFrontendMetricExporter) MetricExporter ¶ added in v0.13.6
func (PlainFrontendMetricExporter) Opts ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Opts() *dagui.FrontendOpts
func (PlainFrontendMetricExporter) RevealAllSpans ¶ added in v0.15.0
func (fe PlainFrontendMetricExporter) RevealAllSpans()
func (PlainFrontendMetricExporter) SetCloudURL ¶ added in v0.13.6
func (PlainFrontendMetricExporter) SetPrimary ¶ added in v0.13.6
func (PlainFrontendMetricExporter) SetSidebarContent ¶ added in v0.19.0
func (fe PlainFrontendMetricExporter) SetSidebarContent(SidebarSection)
func (PlainFrontendMetricExporter) SetVerbosity ¶ added in v0.15.3
func (fe PlainFrontendMetricExporter) SetVerbosity(n int)
func (PlainFrontendMetricExporter) Shell ¶ added in v0.16.3
func (fe PlainFrontendMetricExporter) Shell(ctx context.Context, handler ShellHandler)
func (PlainFrontendMetricExporter) SpanExporter ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) SpanExporter() sdktrace.SpanExporter
func (PlainFrontendMetricExporter) Temporality ¶ added in v0.13.6
func (fe PlainFrontendMetricExporter) Temporality(ik sdkmetric.InstrumentKind) metricdata.Temporality
type Rave ¶ added in v0.19.7
type Rave struct {
// Show extra details useful for debugging a desynced rave.
ShowDetails bool
// The animation to display.
Frames SpinnerFrames
// contains filtered or unexported fields
}
type ShellHandler ¶ added in v0.17.0
type ShellHandler interface {
// Handle processes shell input
Handle(ctx context.Context, input string) error
// AutoComplete provides shell auto-completion functionality
AutoComplete(entireInput [][]rune, line, col int) (string, editline.Completions)
// IsComplete determines if the current input is a complete command
IsComplete(entireInput [][]rune, line int, col int) bool
// Prompt generates the shell prompt string
Prompt(ctx context.Context, out TermOutput, fg termenv.Color) (string, tea.Cmd)
// Keys returns the keys that will be displayed when the input is focused
KeyBindings(out TermOutput) []key.Binding
// ReactToInput allows reacting to live input before it's submitted
ReactToInput(ctx context.Context, msg tea.KeyMsg, editing bool, edit *editline.Model) tea.Cmd
// Shell handlers can man-in-the-middle history items to preserve per-entry modes etc.
editline.HistoryEncoder
}
ShellHandler defines the interface for handling shell interactions
type SidebarSection ¶ added in v0.19.0
type SidebarSection struct {
// A heading to show for the content, if any. If empty, the content will be
// placed in the topmost portion of the sidebar.
Title string
// The content to display.
Content string
// The content to display, for a given width.
ContentFunc func(int) string
// Keymap associated with this section
KeyMap []key.Binding
}
func (SidebarSection) Body ¶ added in v0.19.4
func (sec SidebarSection) Body(width int) string
type SpinnerFrames ¶ added in v0.19.7
SpinnerFrames contains animation frames.
type TermOutput ¶ added in v0.16.3
type TermOutput interface {
io.Writer
String(...string) termenv.Style
ColorProfile() termenv.Profile
}
TermOutput is an interface that captures the methods we need from termenv.Output
type UpdatePromptMsg ¶ added in v0.17.0
type UpdatePromptMsg struct{}
type Vterm ¶ added in v0.9.9
type Vterm struct {
Offset int
Height int
Width int
Prefix string
Profile termenv.Profile
// 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.
func (*Vterm) ScrollPercent ¶ added in v0.9.9
func (*Vterm) UsedHeight ¶ added in v0.9.9
type WithDirectoryArgs ¶ added in v0.19.7
WithDirectoryArgs represents the arguments for withMountedDirectory calls
func (WithDirectoryArgs) Render ¶ added in v0.19.7
func (a WithDirectoryArgs) Render(out TermOutput) (string, []string, bool)
type WithEnvVariableArgs ¶ added in v0.19.7
WithEnvVariableArgs represents the arguments for withEnvVariable calls
func (WithEnvVariableArgs) Render ¶ added in v0.19.7
func (a WithEnvVariableArgs) Render(out TermOutput) (string, []string, bool)
type WithExecArgs ¶ added in v0.19.7
type WithExecArgs struct {
Args []string `json:"args"`
}
WithExecArgs represents the arguments for withExec calls
func (WithExecArgs) Render ¶ added in v0.19.7
func (a WithExecArgs) Render(out TermOutput) (string, []string, bool)
type WithFileArgs ¶ added in v0.19.7
WithFileArgs represents the arguments for withFile calls
func (WithFileArgs) Render ¶ added in v0.19.7
func (a WithFileArgs) Render(out TermOutput) (string, []string, bool)
type WithMountedDirectoryArgs ¶ added in v0.19.7
WithMountedDirectoryArgs represents the arguments for withMountedDirectory calls
func (WithMountedDirectoryArgs) Render ¶ added in v0.19.7
func (a WithMountedDirectoryArgs) Render(out TermOutput) (string, []string, bool)
type WithMountedFileArgs ¶ added in v0.19.7
WithMountedFileArgs represents the arguments for withMountedFile calls
func (WithMountedFileArgs) Render ¶ added in v0.19.7
func (a WithMountedFileArgs) Render(out TermOutput) (string, []string, bool)
type WithNewFileArgs ¶ added in v0.19.7
func (WithNewFileArgs) Render ¶ added in v0.19.7
func (a WithNewFileArgs) Render(out TermOutput) (string, []string, bool)
type WithUserArgs ¶ added in v0.19.7
type WithUserArgs struct {
Name string `json:"name"`
}
WithUserArgs represents the arguments for withUser calls
func (WithUserArgs) Render ¶ added in v0.19.7
func (a WithUserArgs) Render(out TermOutput) (string, []string, bool)
type WithWorkdirArgs ¶ added in v0.19.7
type WithWorkdirArgs struct {
Path string `json:"path"`
}
WithWorkdirArgs represents the arguments for withWorkdir calls
func (WithWorkdirArgs) Render ¶ added in v0.19.7
func (a WithWorkdirArgs) Render(out TermOutput) (string, []string, bool)