github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0085.yml (about) 1 doc_meta: | 2 folder: template 3 title: splitLines func 4 head: | 5 Showcase the usage of splitLines func 6 7 sections: 8 9 - title: Demo 10 log: yes 11 12 notes: 13 goal: 14 - splitLine test 15 16 vars: 17 workers: 18 - peter 19 - tom 20 - james 21 22 lines: |- 23 hello 24 this 25 is a 26 beautiful world 27 28 tasks: 29 - 30 name: task 31 desc: generate logs 32 task: 33 34 - 35 func: shell 36 dvars: 37 - name: linelist 38 desc: | 39 dvar value always return a string instead of object, if you 40 need to use the object, you will need to register it to global space 41 value: '{{ .lines | splitLines }}' 42 flags: [vvv] 43 44 do: 45 - echo '{{.lines}}' 46 - echo '{{.linelist}}' 47 48 - 49 func: shell 50 dvars: 51 - name: linelist 52 value: '{{ .lines | splitLines | printObj }}' 53 flags: [vvv] 54 55 do: 56 - echo '{{.lines}}' 57 - echo '{{.linelist}}' 58 59 - 60 func: shell 61 name: regtest 62 dvars: 63 - name: linelist 64 value: '{{ .lines | splitLines | reg "linelist_object" }}' 65 flags: [vvv] 66 do: 67 - echo '{{.lines}}' 68 - echo '{{.linelist}}' 69 - echo '{{.linelist_object}}' 70 71 - 72 func: shell 73 loop: workers 74 do: 75 - echo "{{.loopindex1}} -> {{.loopitem}}" 76 77 - 78 func: shell 79 loop: linelist_object 80 do: 81 - echo "{{.loopindex1}} -> {{.loopitem}}"