Documentation
¶
Index ¶
Constants ¶
View Source
const MaxOutputLineBytes = 4 << 20
Variables ¶
This section is empty.
Functions ¶
func CommandContext ¶
CommandContext binds cancellation to the whole command tree. Build tools and task commands can spawn children that otherwise retain pipes after the parent exits.
func NowRFC3339Nano ¶
func NowRFC3339Nano() string
Types ¶
type CommandSpec ¶
type CommandSpec struct {
Name string
Args []string
Dir string
Env map[string]string
LogPath string
AppendLog bool
OnLine func(stream, line string)
Grace time.Duration
ReadyWait time.Duration
Interactive bool
// Terminal gives a prompting child its own terminal; output streams are merged.
Terminal bool
Prompts []PromptSpec
OnPrompt func(PromptRequest) (PromptResponse, error)
ParsePrompt PromptParser
// GracefulStop replaces the initial termination signal with a protocol-specific
// shutdown request. It must honor its context; request and exit share Grace.
// Failure or expiry still escalates to an OS process-tree kill.
GracefulStop func(context.Context) error
}
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
func (*Handle) WriteString ¶
type PromptKind ¶
type PromptKind string
const ( PromptConfirm PromptKind = "confirm" PromptText PromptKind = "text" PromptSelect PromptKind = "select" )
type PromptMatch ¶
type PromptMatch struct {
Request PromptRequest
Input func(PromptResponse) (string, error)
}
PromptMatch describes a rendered question and translates an explicit answer into the child's input protocol. Input returns exact bytes, without an added newline.
type PromptParser ¶
type PromptParser func(string) *PromptMatch
PromptParser recognizes tool-specific questions in bounded, settled output. It must return nil for incomplete output and completed prompt redraws.
type PromptRequest ¶
type PromptRequest struct {
Prompt string
Kind PromptKind
Secret bool
Choices []string
}
type PromptResponse ¶
type PromptResponse struct {
Value string
}
type PromptSpec ¶
Click to show internal directories.
Click to hide internal directories.