Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The following snippet produces a choice Form and then uses
- # a shell script to swap its input for different values.
- # It's an alternative to label: & id: use, that
- # enables the use of the choice: drop-down facility
- - trigger: :test
- replace: "{{output}}"
- vars:
- - name: form1
- type: form
- params:
- layout: "[[choices]]"
- fields:
- choices:
- type: choice
- values: |
- one
- two
- three
- default: one
- - name: output
- type: shell
- params:
- shell: bash
- cmd: |
- case $"{{form1.choices}}" in
- one)
- output=four ;;
- two)
- output=five ;;
- three)
- output=six ;;
- esac
- echo $output
- # For Python, replace the "output" block with:
- - name: output
- type: script
- params:
- args:
- - python
- - -c
- - |
- choices = {
- "one": "four",
- "two": "five",
- "three": "six"
- }
- print(choices.get("{{form1.choices}}", ""))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement