There is a special format that allows steps to be hidden based on user selections. For example, if you are writing a programming guide, you might have a different command to run if the user is on a Mac vs a PC.
This can be done with --select
, --option
, and --if
statements.
Here's an example:
# How to plant tomatoes
--select location Where will you plant?
--option indoors Inside
--option outdoors Outside
## Gather the materials
...
## Ensure there is sufficient light
--if location=indoors
...
## Protect from animals
--if location=outdoors
...
For select
/option
, the first part is the "ID" of the value, and then everything after is the label.
The --if
format supports id=value
or id!=value
.
If the condition matches, the step will be visible, otherwise it won't be shown. Convenient!