-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkREADME
executable file
·31 lines (25 loc) · 881 Bytes
/
mkREADME
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
#!/usr/bin/python3
from os import path
import csvspoon._cli
import subprocess
here = path.abspath(path.dirname(__file__))
with open("{}/README.md".format(here), "w") as fout:
with open("{}/.README_header.md".format(here)) as fin:
for l in fin:
fout.write(l)
fout.write("## Cli usage\n")
fout.write(
"```\n{}\n```\n".format(
subprocess.run(["csvspoon", "-h"], capture_output=True).stdout.decode()
)
)
for subcommand in ("cat", "apply", "filter", "sort", "join", "aggregate"):
fout.write("## `csvspoon {}`\n".format(subcommand))
fout.write(
"```\n{}\n```\n".format(
subprocess.run(
["csvspoon", subcommand, "-h"], capture_output=True
).stdout.decode()
)
)
fout.write(csvspoon._cli.cli_example_main_doc())