prompt
Ask the user for a value or for confirmation
You can use
prompt
to ask the user for a value or to just let the user confirm the next step.
When this is executed on a CI service, the passedci_input
value will be returned.
This action also supports multi-line inputs using themulti_line_end_keyword
option.
prompt | |
---|---|
Supported platforms | mac, linux, windows |
Author | @KrauseFx, @johnknapprs |
2 Examples
changelog = prompt(text: "Changelog: ")
changelog = prompt( text: "Changelog: ", multi_line_end_keyword: "END" ) puts changelog
Parameters
Key | Description | Default |
---|---|---|
text |
The text that will be displayed to the user | Please enter some text: |
ci_input |
The default text that will be used when being executed on a CI service | '' |
boolean |
Is that a boolean question (yes/no)? This will add (y/n) at the end | false |
secure_text |
Is that a secure text (yes/no)? | false |
multi_line_end_keyword |
Enable multi-line inputs by providing an end text (e.g. 'END') which will stop the user input |
* = default value is dependent on the user's system
Documentation
To show the documentation in your terminal, run
pantograph action prompt
CLI
It is recommended to add the above action into your Pantfile
, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal
pantograph run prompt
To pass parameters, make use of the :
symbol, for example
pantograph run prompt parameter1:"value1" parameter2:"value2"
It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"
). Hashes are not currently supported.
It is recommended to add all pantograph actions you use to your Pantfile
.
Source code
This action, just like the rest of pantograph, is fully open source, view the source code on GitHub