Hello World formula

In this section, you will find how to run a “hello-world” formula.

Hello World

To add the ritchie-formulas-demo repository locally, you can use the rit add repo command, or run the command line below:

rit add repo --provider="Github" --name="demo" --repoUrl="https://github.com/ZupIT/ritchie-formulas-demo" --priority=1

Now, check the details of the formula, you can execute this tutorial commands.

Premisse: Check the formula’s details

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.

Scenarios

On Ritchie, you have 6 possibilities to run a formula through these flags:

  1. Via Prompt
  2. Via Prompt e Docker
  3. Via Input Flags
  4. Via Input Flags e Docker
  5. Via Stdin
  6. Via Stdin e Docker

You can see them below, choose a case and type the following commands lines.

Option 1: With Prompt

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.

Option 2: With Prompt and Docker

You can run the same command using the –docker flag pto execute it remotely (on a container), but still using prompt to inform the inputs parameters:

rit demo hello-world --docker

Option 3: With Input Flags

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"

Option 4: With Input flags and Docker

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

Option 5: With Stdin

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 --stdin

Option 6: With Stdin and Docker

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

Next steps


Last modified October 29, 2021: Doc review (#161) (ef9c57d8)