Premisse: After you finished the previous steps -installation and initialization - to access the hello-world formula to test Ritchie, you'll need to add the ritchie-formulas-demo repository locally
.
To do so, you can use the rit add repo
command, or execute the command line below:
echo '{"provider":"Github", "name":"demo", "url":"https://github.com/ZupIT/ritchie-formulas-demo", "priority":1}' | rit add repo --stdin
You can also check which repositories you're using with therit list repo
command.
Now that you have added the demo
repository and check the details of the formula, you can execute this tutorial commands.
To get details about a formula, you can execute the command using with the --help
flag:
rit demo hello-world --help
It will return all the flags available for the command execution.
Using Prompt
Using Prompt and Docker
Using Input Flags
Using Input Flags and Docker
Using Stdin
Using Stdin and Docker
To do so, type the following commands lines:
As this formula has been coded using Golang, it is necessary to have Golang installed on your computer to run it locally.
rit demo hello-world
Select an option for each input parameter and see how the magic works:
This is the default command line execution, that runs the formula locally using prompt to inform the input parameters.
You can run the same command using the --docker flag to execute it remotely (on a container), but still using prompt to inform the inputs parameters:
rit demo hello-world --docker
Docker needs to be installed and running on your computer for this flag to work. In that case, you won't need to have Golang installed.
You can also run the command informing the inputs through flags (you can know which flags are available using the --help
flag when executing a command). This way, inputs parameters are informed directly with the command line.
rit demo hello-world --rit_input_text=Dennis --rit_input_boolean=true --rit_input_list=everything --rit_input_password=Ritchie
When you combine both input flags
and the --docker
flag, it is possible to run a command remotely (on a container) with the input parameters directly informed on the command line:
rit demo hello-world --rit_input_text=Dennis --rit_input_boolean=true --rit_input_list=everything --rit_input_password=Ritchie --docker
You can also run the command with the --stdin (Standard input) flag. This way, inputs parameters are also informed directly with the command line.
echo '{"rit_input_text":"Dennis", "rit_input_boolean":"true", "rit_input_list":"everything", "rit_input_password":"Ritchie"}' | rit demo hello-world --stdinRitchie uses the json format to execute STDIN commands
Ritchie uses the JSON format to execute STDIN commands
When you combine both --stdin and --docker flags, it is also possible to run a command remotely (on a container) with the input parameters directly informed on the command line:
echo '{"rit_input_text":"Dennis", "rit_input_boolean":"true", "rit_input_list":"everything", "rit_input_password":"Ritchie"}' | rit demo hello-world --stdin --docker
Take a look at the formulas repositories (ex: ritchie-formulas).
Most of the community formulas are composed of a README file explaining what the command does and how to run it.
In this section, you saw how to run formulas on Ritchie. To keep learning:
👉Check which formulas you can run using the following command:
rit --help
👉See how to create new formulas.