Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { Run(ctx context.Context, t Target, args Arguments) (string, error) String() string }
Action represents an action that can be applied.
The Run method applies the action to a given target and returns a string describing the result.
Actions should not mutate themselves or have side effects since they are intended to be run multiple times with different targets, possible on different goroutines.
The String method provides a string description of the action.
type Arguments ¶
type Arguments struct { // Values for variables that can be expanded during actions. Variables map[string]string }
Arguments contains additional arguments that can be provided when running an Action.
type Config ¶
type Config struct { // Identifies the type of action. Required for all actions. Type string `yaml:"type"` // The text to search for in a text action. SearchText string `yaml:"searchText"` // The text to apply in a text action. ApplyText string `yaml:"applyText"` // The path to the file in a text file. // Must be relative to the target root. Path string `yaml:"path"` // The source file to use in a file action. SrcPath string `yaml:"srcPath"` // The destination file to use in a file action. // Must be relative to the target root. DstPath string `yaml:"dstPath"` // The command to run in a command action. Run string `yaml:"run"` }
Config is used to configure an action. It is passed to Parse to create an Action instance.
Click to show internal directories.
Click to hide internal directories.