github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0180.yml (about) 1 doc_meta: | 2 folder: shell-func 3 title: silent the shell execution 4 head: | 5 You can use the flag silent to silent the shell execution, or silent-x to silent the sub step of the shell execution 6 7 sections: 8 - title: Demo 9 log: yes 10 11 tasks: 12 - 13 name: task 14 task: 15 16 - func: shell 17 desc: the output of cat would be silent 18 vars: 19 msg: | 20 hello, world 21 thank you 22 hello tom 23 good buy 24 do: 25 - echo """{{.msg}}""" > /tmp/msg 26 - cat /tmp/msg 27 flags: 28 - silent 29 30 - 31 func: cmd 32 desc: explicitly show the the shell exec result 33 do: 34 - name: print 35 cmd: '{{.last_result.Output}}' 36 37 - func: shell 38 desc: the silent will not affect output of failed shell execution 39 vars: 40 msg: | 41 hello, world 42 thank you 43 hello tom 44 good buy 45 do: 46 - | 47 >&2 echo "encountering an error" 48 exit -1 49 flags: 50 - silent 51 - ignoreError 52 53 54 - func: shell 55 desc: | 56 silient only one sub step but not all 57 in this case, it will make sub step 1 msg1 silent but not the msg2 58 vars: 59 msg1: sub step1 60 msg2: sub step2 61 do: 62 - echo """{{.msg1}}""" 63 - echo """{{.msg2}}""" 64 flags: 65 - silent-1 66 67 - func: shell 68 desc: | 69 silient only one sub step but not all 70 in this case, it will make sub step 2 msg2 silent but not the msg1 71 vars: 72 msg1: sub step1 73 msg2: sub step2 74 do: 75 - echo """{{.msg1}}""" 76 - echo """{{.msg2}}""" 77 flags: 78 - silent-2 79 80 - func: shell 81 desc: | 82 if there are combined flags of silent and silent-x, silent will take priority, then there will be no output for all of the sub steps 83 vars: 84 msg1: sub step1 85 msg2: sub step2 86 do: 87 - echo """{{.msg1}}""" 88 - echo """{{.msg2}}""" 89 flags: 90 - silent-1 91 - silent