-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makereadme.cwlex
34 lines (34 loc) · 948 Bytes
/
makereadme.cwlex
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
def tool main(tmpl=
File("README.md.tmpl",
"tests/examples/reverse.cwlex",
"tests/examples/ex2.cwlex",
"tests/examples/ex3.cwlex",
"tests/examples/echo.cwlex",
"tests/examples/ex5.cwlex",
"tests/examples/ex6.cwlex",
"tests/examples/ex7.cwlex",
"tests/examples/ex8.cwlex",
"tests/examples/ex9.cwlex",
"tests/examples/ex10.cwlex",
"tests/examples/ex11.cwlex",
"tests/examples/ex12.cwlex",
"tests/examples/ex13.cwlex",
"tests/examples/ex14.cwlex"))
{
python <<<
import os
inputs = $(inputs)
f = open(inputs["tmpl"]["path"])
a = open("README.md", "w")
for line in f:
if line.startswith("$include: "):
with open(os.path.join(os.path.dirname(inputs["tmpl"]["path"]), line[10:].rstrip())) as b:
c = b.read()
a.write(c)
if c[-1] != "\\n":
a.write("\\n")
else:
a.write(line)
>>>
return File("README.md") as readme
}