-
Notifications
You must be signed in to change notification settings - Fork 4
/
c0071.yml
103 lines (85 loc) · 2.22 KB
/
c0071.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
91
92
93
94
95
96
97
98
99
100
101
102
103
doc_meta: |
folder: cmd-func
title: read/write file
head: |
Showcase how to use readFile and writeFile cmd
sections:
- title: my story text file reference
filelookup: d0070.txt
- title: How to use?
content: |
* writeFile
conent: the static or dynamic content
filename: the filename to write to
dir: directory of the file to save to
* readFile
filename: the filename to read from
dir: directory of the file to read from
reg: the register var name of the file content will be loaded to
- title: Demo
log: yes
notes:
goal:
- use dvar ref to load common file only
- add cmd readFile and register to a named var
- add cmd write file to save to a file
dvars:
- name: mystory
ref: d0070.txt
tasks:
- name: task
task:
- func: call
do:
- case1
- case2
- name: case1
task:
- func: cmd
do:
-
name: print
cmd: "{{.mystory}}"
-
name: writeFile
desc: write content to a file
cmd:
content: "{{.mystory}}"
filename: mystory.txt
dir: /tmp
-
name: readFile
desc: read content of a file and register it to a var
cmd:
filename: mystory.txt
dir: /tmp
reg: my_interesting_story
-
name: print
cmd: "{{.my_interesting_story}}"
- name: case2
task:
- func: cmd
do:
-
name: print
cmd: "{{.mystory}}"
-
name: writeFile
desc: write content to a file
cmd:
content: "{{.mystory}}"
# filename: mystory.txt
# dir: /tmp
filepath: /tmp/mystory.txt
-
name: readFile
desc: read content of a file and register it to a var
cmd:
# filename: mystory.txt
# dir: /tmp
filepath: /tmp/mystory.txt
reg: my_interesting_story
-
name: print
cmd: "{{.my_interesting_story}}"