Documentation
¶
Index ¶
- type ShellCommand
- type ShellCommandDescription
- type ShellCommandLoader
- func (l *ShellCommandLoader) GetFileExtensions() []string
- func (l *ShellCommandLoader) GetName() string
- func (l *ShellCommandLoader) IsFileSupported(f fs.FS, fileName string) bool
- func (l *ShellCommandLoader) LoadCommands(fs_ fs.FS, filePath string, options []glazed_cmds.CommandDescriptionOption, ...) ([]glazed_cmds.Command, error)
- type ShellCommandOption
- func WithCaptureStderr(capture bool) ShellCommandOption
- func WithCommand(cmd []string) ShellCommandOption
- func WithCwd(cwd string) ShellCommandOption
- func WithDebug(debug bool) ShellCommandOption
- func WithEnvironment(env map[string]string) ShellCommandOption
- func WithSaveScriptDir(dir string) ShellCommandOption
- func WithShellScript(script string) ShellCommandOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShellCommand ¶
type ShellCommand struct {
*cmds.CommandDescription
ShellScript string
Command []string
Cwd string
Environment map[string]string
CaptureStderr bool
Debug bool
SaveScriptDir string
}
ShellCommand is the runtime representation of a shell command
func LoadShellCommand ¶ added in v0.0.2
func LoadShellCommand(path string) (*ShellCommand, error)
func LoadShellCommandFromYAML ¶
func LoadShellCommandFromYAML(data []byte) (*ShellCommand, error)
LoadShellCommandFromYAML creates a new ShellCommand from YAML data
func NewShellCommand ¶
func NewShellCommand( description *cmds.CommandDescription, options ...ShellCommandOption, ) (*ShellCommand, error)
NewShellCommand creates a new ShellCommand with the given options
func (*ShellCommand) ExecuteCommand ¶
func (c *ShellCommand) ExecuteCommand( ctx context.Context, args map[string]interface{}, w io.Writer, ) error
ExecuteCommand handles the actual command execution
func (*ShellCommand) RunIntoWriter ¶
func (c *ShellCommand) RunIntoWriter( ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer, ) error
RunIntoWriter implements the WriterCommand interface
type ShellCommandDescription ¶
type ShellCommandDescription struct {
Name string `yaml:"name"`
Short string `yaml:"short"`
Long string `yaml:"long,omitempty"`
Flags []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`
Layers []layers.ParameterLayer `yaml:"layers,omitempty"`
ShellScript string `yaml:"shell-script,omitempty"`
Command []string `yaml:"command,omitempty"`
Cwd string `yaml:"cwd,omitempty"`
Environment map[string]string `yaml:"environment,omitempty"`
CaptureStderr bool `yaml:"capture-stderr,omitempty"`
Debug bool `yaml:"debug,omitempty"`
SaveScriptDir string `yaml:"save-script-dir,omitempty"`
}
ShellCommandDescription represents the YAML structure for shell commands
type ShellCommandLoader ¶
type ShellCommandLoader struct{}
func (*ShellCommandLoader) GetFileExtensions ¶
func (l *ShellCommandLoader) GetFileExtensions() []string
func (*ShellCommandLoader) GetName ¶
func (l *ShellCommandLoader) GetName() string
func (*ShellCommandLoader) IsFileSupported ¶
func (l *ShellCommandLoader) IsFileSupported(f fs.FS, fileName string) bool
func (*ShellCommandLoader) LoadCommands ¶
func (l *ShellCommandLoader) LoadCommands( fs_ fs.FS, filePath string, options []glazed_cmds.CommandDescriptionOption, aliasOptions []alias.Option, ) ([]glazed_cmds.Command, error)
type ShellCommandOption ¶
type ShellCommandOption func(*ShellCommand)
func WithCaptureStderr ¶
func WithCaptureStderr(capture bool) ShellCommandOption
func WithCommand ¶
func WithCommand(cmd []string) ShellCommandOption
func WithCwd ¶
func WithCwd(cwd string) ShellCommandOption
func WithDebug ¶
func WithDebug(debug bool) ShellCommandOption
func WithEnvironment ¶
func WithEnvironment(env map[string]string) ShellCommandOption
func WithSaveScriptDir ¶ added in v0.0.9
func WithSaveScriptDir(dir string) ShellCommandOption
func WithShellScript ¶
func WithShellScript(script string) ShellCommandOption
Click to show internal directories.
Click to hide internal directories.