github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0126.yml (about) 1 doc_meta: | 2 folder: flow-controll 3 title: else in hard way 4 head: | 5 Try to implement the else logic using if condition 6 7 It works but it is not dry 8 9 sections: 10 - title: Demo 11 log: yes 12 13 notes: 14 goal: 15 - try to see if it possible to make a flow controll of else logic 16 - intro the 1st solution doing if else 17 18 vars: 19 goahead: False 20 # goahead: True 21 22 tasks: 23 24 - name: task 25 task: 26 27 - func: cmd 28 do: 29 - 30 name: print 31 cmd: | 32 true/false value of goahead: 33 {{.goahead}} 34 {{not .goahead}} 35 36 - func: call 37 do: 38 - goahead 39 if: '{{.goahead}}' 40 41 - func: call 42 do: 43 - else 44 if: '{{not .goahead}}' 45 46 - name: goahead 47 task: 48 - func: cmd 49 do: 50 - 51 name: print 52 cmd: 'go ahead .......' 53 54 - name: else 55 task: 56 - func: cmd 57 do: 58 - 59 name: print 60 cmd: 'do something else .......'