README - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
README (873B)
---
1 csvtotext
2 =========
3
4 Convert input CSV to output text using a text template.
5
6
7 Usage
8 =====
9
10 csvtotext reads CSV from stdin and outputs text to stdout.
11
12 An example how to use it:
13
14 csvtotext -template template.xml < input.csv > output.xml
15
16 The default template name if not specified is "template.txt". The input should
17 be a valid CSV, on a parsing error csvtotext will output the error string and
18 exit with status 1.
19
20
21 Templates
22 =========
23
24 Templates are "text/template" as defined in Golang:
25 http://golang.org/pkg/text/template/
26
27 The first line in the CSV are assumed to be column headers and will be used as
28 template names. The names will be sanitized to be lowercase and
29 have only: [a-z0-9_]. Template struct names starting with a number will be prefixed with '_'.
30
31 Example of a template:
32
33 START
34 {{range .rows}}
35 #{{.Index}}: this is executed per row.
36 {{end}}
37