Pipelines
Pipelines allow you to define a step-by-step execution process from a CLI command. With a pipeline, you can create anything from a form with user interaction via terminal, make HTTP calls, transform JSON or YAML files into variables for use in templates, generate custom code structures, add logs, and conditionally execute other pipelines.
Structure
Pipelines are YAML files and must be located within the .mr-smith/pipelines
folder to be recognized.
The file must be in map format, where the key represents the declaration of a pipeline.
A pipeline is composed of the following structure:
- description: Description of the action to be performed by the pipeline.
- steps: Array of steps that will be executed in order when calling a pipeline.
- visible: Boolean value that determines if the pipeline will be visible for execution via terminal (
true
) or only for other pipelines (false
). Default value:true
.
Steps
- Form: Used to display interactive forms in the terminal.
- Cmd: Executes commands in the terminal during the pipeline execution.
- Define: Defines new variables during the pipeline execution.
- Log: Allows displaying messages in the terminal during the pipeline execution.
- Load: Loads data from a local or remote file (JSON or YAML) and stores it in a variable.
- Create: Generates new files or directories from templates based on a predefined structure.
- Modify: Alters existing files based on templates, allowing for content insertion, replacement, or removal.
- Pipeline: Executes another pipeline within the current one.
- When: Conditionally executes a pipeline.
Using Variables
The values of each property of each step are Go template strings, which may contain variables, functions, and expressions just like any other template. Usage: .data.variableName
.
To learn more about text templates and how to use them with Mr. Smith, visit the link: Text Templates in Go
Example
Executing a Pipeline
Check the complete documentation for the mr run
command here