Advertisement
smeech

Second choice conditional on first choice

Jul 23rd, 2024 (edited)
170
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.87 KB | Source Code | 0 0
  1.  - trigger: :test
  2.     replace: "{{output}}"
  3.     vars:
  4.       - name: select
  5.         type: choice
  6.         params:
  7.           values: ["1","2"]
  8.       - name: items
  9.         type: shell
  10.         params:
  11.           cmd: |
  12.            # Generate lists for second choice:
  13.             items=("a" "b" "c") # Items for choice "1"
  14.             printf "%s\n" "${items[@]}" > $CONFIG/match/file1 # or Windows equivalents
  15.             items=("d" "e" "f") # Items for choice "2"
  16.             printf "%s\n" "${items[@]}" > $CONFIG/match/file2 # or Windows equivalents
  17.             # Generate {{items}} dependent on first choice            
  18.             cat $CONFIG/match/file{{select}} # or "type" for Windows
  19.             # Remove temporary files
  20.             rm -f $CONFIG/match/file1 $CONFIG/match/file2
  21.       - name: output
  22.         type: choice
  23.         params:
  24.           values: "{{items}}"
Advertisement
Comments
  • smeech
    152 days
    # text 0.25 KB | 0 0
    1. The trigger, :test invokes the first select choice box, which supplies a digit, 1 or 2, which is suffixed to the filename for the cat command in the items variable. This supplies the three options from file1 or file2 for the second output choice variable.
Add Comment
Please, Sign In to add comment
Advertisement