From: Serge A. Zaitsev Date: Fri, 5 Dec 2014 17:26:59 +0000 (+0200) Subject: moved eval func type to the top, added some error logs X-Git-Tag: 0.0.1~45 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=2895462bca58cefa01789fcedbb568ff7f417103;p=aya.git moved eval func type to the top, added some error logs --- diff --git a/zs.go b/zs.go index e9c3b01..12cddbd 100644 --- a/zs.go +++ b/zs.go @@ -21,6 +21,8 @@ const ( PUBDIR = ".pub" ) +type EvalFn func(args []string, vars map[string]string) (string, error) + func split2(s, delim string) (string, string) { parts := strings.SplitN(s, delim, 2) if len(parts) == 2 { @@ -43,8 +45,6 @@ func md(s string) (map[string]string, string) { return v, body } -type EvalFn func(args []string, vars map[string]string) (string, error) - func render(s string, vars map[string]string, eval EvalFn) (string, error) { b := []byte(s) delim_open := []byte("{{") @@ -228,7 +228,7 @@ func main() { buildAll(false) // pass duration case "var": if len(args) == 0 { - // print error + log.Println("ERROR: filename expected") return } if b, err := ioutil.ReadFile(args[0]); err == nil { @@ -244,7 +244,7 @@ func main() { } } } else { - // print error + log.Println(err) } default: cmd := exec.Command(path.Join(ZSDIR, cmd), args...)