aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/main.go b/main.go
index a13ba34..3dd8969 100644
--- a/main.go
+++ b/main.go
@@ -12,6 +12,7 @@ package main
import (
"flag"
"fmt"
+ "log"
"os"
"git.cs.kau.se/rasmoste/ct-sans/internal/ctflag"
@@ -62,8 +63,10 @@ type options struct {
}
func main() {
+ log.SetOutput(os.Stdout)
+ log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
if ctflag.WantHelp(os.Args, 1) {
- fmt.Fprintf(os.Stderr, usage)
+ fmt.Fprintf(os.Stdout, usage)
os.Exit(1)
}
@@ -79,12 +82,12 @@ func main() {
// Parse command-line options and hardcode additional values
if err := ctflag.Parse(fs, os.Args[2:]); err != nil {
if err == flag.ErrHelp {
- fmt.Fprintf(os.Stderr, usage)
+ fmt.Fprintf(os.Stdout, usage)
os.Exit(1)
}
- fmt.Fprintf(os.Stderr, "error: %v\n\n", err)
- os.Exit(2)
+ fmt.Fprintf(os.Stdout, "error: %v\n\n", err)
+ os.Exit(1)
}
opts.logDirectory = opts.Directory + "/" + "logs"
opts.metadataFile = "metadata.json"
@@ -104,11 +107,11 @@ func main() {
case "assemble":
err = assemble(opts)
default:
- fmt.Fprintf(os.Stderr, "ct-sans: unknown command %q\n\n", cmd)
- os.Exit(3)
+ fmt.Fprintf(os.Stdout, "ct-sans: unknown command %q\n\n", cmd)
+ os.Exit(1)
}
if err != nil {
- fmt.Fprintf(os.Stderr, "ct-sans %s: error: %v\n", os.Args[1], err)
- os.Exit(4)
+ fmt.Fprintf(os.Stdout, "ct-sans %s: error: %v\n", os.Args[1], err)
+ os.Exit(1)
}
}