recipe-runner / io-module
IO module for Recipe Runner
dev-master / 1.0.x-dev
2019-07-19 14:19 UTC
Requires
- php: ^7.2
- recipe-runner/recipe-runner: 1.0.x-dev
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-11-20 02:27:21 UTC
README
Input/output operations such as write
or ask
for interacting with the user.
Requires
- PHP +7.2
- Recipe Runner
Installation
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"
Usage
Method: write
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 :)"
Method: ask
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" }
Method ask_yes_no
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 }
For module developers
The preferred installation method is composer:
composer require recipe-runner/io-module
Unit tests
You can run the unit tests with the following command:
$ cd io-module $ composer test
License
This library is open-sourced software licensed under the MIT license.