summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.go b/main.go
index 78834c8..260f03b 100644
--- a/main.go
+++ b/main.go
@@ -66,6 +66,7 @@ func name(s string) string {
func main() {
file := flag.String("file", "", "Color scheme .itemcolors")
tmpl := flag.String("tmpl", "scheme.tmpl", "Xresources template")
+ out := flag.String("out", "-", "output")
flag.Parse()
body, err := ioutil.ReadFile(*file)
if err != nil {
@@ -80,5 +81,12 @@ func main() {
log.Fatal(err)
}
s.Name = name(*file)
- t.Execute(os.Stdout, s)
+ fd := os.Stdout
+ if *out != "-" {
+ fd, err = os.Create(*out)
+ if err != nil {
+ log.Fatal(err)
+ }
+ }
+ t.Execute(fd, s)
}