Documentation
¶
Index ¶
Constants ¶
View Source
const ( RawOutputIndicator = "@raw" SelectIndexIndicator = "@idx:" PageIndexIndicator = "@page:" )
Variables ¶
View Source
var BuiltinCmdPrefix = "exec run"
BuiltinCmdPrefix defines a plugin prefix. It's useful to change it if x lib is used as SDK in different executor plugins.
View Source
var ( //go:embed config_schema_fmt.json ConfigJSONSchemaFmt string )
Functions ¶
func GetPluginDependencies ¶
func GetPluginDependencies() map[string]api.Dependency
GetPluginDependencies returns exec plugin dependencies.
Types ¶
type Config ¶
type Config struct {
Templates []getter.Source `yaml:"templates"`
Logger config.Logger
// Fields not exposed to the user in the JSON schema
TmpDir pluginx.TmpDir `yaml:"tmpDir"`
}
Config holds exec plugin configuration.
type Render ¶
type Render interface {
// RenderMessage receives command output and a template and produce a final message.
RenderMessage(cmd, output string, state *state.Container, msgCtx *template.Template) (api.Message, error)
}
Render is an interface that knows how to render a given command output.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer provides functionality to render command output in requested format.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner runs command and parse its output if needed.
func NewRunner ¶
func NewRunner(log logrus.FieldLogger, renderer *Renderer) *Runner
NewRunner returns a new Runner instance.
func (*Runner) Run ¶
func (i *Runner) Run(ctx context.Context, cfg Config, state *state.Container, cmd Command, runFn func() (string, error)) (executor.ExecuteOutput, error)
Run runs a given command and parse its output if needed.
func (*Runner) RunWithTemplates ¶
func (i *Runner) RunWithTemplates(templates []template.Template, state *state.Container, cmd Command, runFn func() (string, error)) (executor.ExecuteOutput, error)
RunWithTemplates runs a given command and parse its output if needed. It uses specified templates instead of downloading them.
Click to show internal directories.
Click to hide internal directories.