-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0042.yml
90 lines (77 loc) · 2.33 KB
/
c0042.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
doc_meta: |
folder: object-oriented
title: reg/deReg/void
head: |
You can use template func reg to register a value to global runtime or deReg to remove it from runtime
sections:
- title: Important note
content: |
reg will register the value into global runtime
If you do not need to use the dvar value instead of the register object, then use void as the dvar name, it will not create a new var and put into global runtime
You can always use void as the name of a dvar, so that the dvar is used more like action method to do things rather than rendering value
- title: Demo
log: yes
related:
refs:
- title: convert dvar
link: ../../dvars/c0027/
notes:
goal:
- add feature to use .last_result to have a quick shortcut access to last task result
tasks:
-
name: task
desc: test the exit scenarios due to different types of validation
task:
-
func: shell
desc: step1
do:
- echo tom
- echo hanks
-
func: shell
desc: |
the last result of hanks will be registered as varname: hellomsg
dvars:
- name: reg_hello
value: |
hello: {{.last_result.Output|reg "hellomsg" }}
flags:
- v
do:
- echo "hellomsg - {{.hellomsg}}"
- echo "reg_hello - {{.reg_hello}}"
-
func: shell
desc: |
the hellomsg will be still availabe in this step
it is removed but will be unavailabe in the next step
dvars:
- name: reg_hello
value: |
{{deReg "hellomsg" }}
do:
- echo "{{.hellomsg}}"
-
func: shell
desc: |
now the hellomsg should be <no value>
do:
- echo "{{.hellomsg}}"
-
func: shell
dvars:
- name: void
desc: |
now this var name will not be shown in local automatically
or in global if you register it as it the reg template func
is more like a action and return sensible value
value: 'hello: {{ print "something" |reg "iamvoid" }}'
flags: [vvv]
do:
- echo '{{.iamvoid}}'
-
func: shell
do:
- echo '{{.iamvoid}}'