Documentation ¶
Overview ¶
Package command implements a command runner that executes a series of local commands based on a JSON specification. Commands can interpolate user-provided arguments, remote configuration, or outputs from other commands.
Index ¶
- type Args
- type Command
- func (c Command) Args(data TemplateData, options TemplateOptions) ([]string, error)
- func (c Command) Display(data TemplateData) (string, error)
- func (c Command) Execute(ctx context.Context, config *Config, args Args, outputs Outputs, ...) ([]byte, error)
- func (c Command) Name() string
- func (c Command) ToCmd(ctx context.Context, data TemplateData) (*exec.Cmd, error)
- type Commands
- type Config
- type Outputs
- type TemplateData
- type TemplateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { ID string `json:"id"` Command []string `json:"command"` Interactive bool `json:"interactive"` DisplayName string `json:"name"` }
Command represents a runnable command.
func (Command) Args ¶ added in v0.1.0
func (c Command) Args(data TemplateData, options TemplateOptions) ([]string, error)
Args renders the command arguments using the provided template data and options.
func (Command) Display ¶ added in v0.0.4
func (c Command) Display(data TemplateData) (string, error)
Display returns the command as a human readable string.
func (Command) Execute ¶ added in v0.1.0
func (c Command) Execute(ctx context.Context, config *Config, args Args, outputs Outputs, streams genericclioptions.IOStreams) ([]byte, error)
Execute runs the command with the given config and outputs.
type Commands ¶
type Commands []*Command
Commands stores a slice of commands and provides some helper execution methods.
func (Commands) Execute ¶ added in v0.1.0
func (c Commands) Execute(ctx context.Context, config *Config, args Args, outputs Outputs, streams genericclioptions.IOStreams) (Outputs, error)
Execute runs each command in the calling slice sequentially using the passed config and the outputs accumulated to that point.
type TemplateData ¶ added in v0.1.0
TemplateData is the data passed to command templates to render the command arguments.
type TemplateOptions ¶ added in v0.1.0
type TemplateOptions struct { // ShowSensitive indicates whether sensitive values should be shown. When false, sensitive values are replaced with asterisks. ShowSensitive bool }
TemplateOptions are the configurable options used in different rendering contexts.