Input/output operations such as write
or ask
for interacting with the user.
- PHP +7.2
- Recipe Runner
Create a recipe and add the module to the packages
section:
name: "Your recipe"
extra:
rr:
packages:
"recipe-runner/io-module": "1.0.x-dev"
Write a message to the output.
steps:
- actions:
- write: "Hi user. Welcome back."
Messages with several lines are allowed:
steps:
- actions:
- write:
"Hi user"
"Welcome :)"
Ask a question to the user.
steps:
- actions:
- ask: "What's your name?"
register: "question1"
- write: "The Response was: '{{question1['response']}}'"
Default value for a question is empty string. Set a custom default value is possible:
ask:
question: "What's your name?"
default: "Jack"
Response:
{
"response": "bla bla"
}
Ask a yes/no question to the user. Values accepted as response:
true
: true, "true", "yes", "1", 1false
: false, "false", "no", "0", 0
Default value: true
.
ask_yes_no: "Are you sure?"
or
ask_yes_no:
question: "What's your name?"
default: true
Response:
{
"response": true
}
The preferred installation method is composer:
composer require recipe-runner/io-module
You can run the unit tests with the following command:
$ cd io-module
$ composer test
This library is open-sourced software licensed under the MIT license.