diff options
author | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-17 17:39:25 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-17 17:39:25 +0100 |
commit | 10f7eb048a0cba6104b52027bff3b6f50db2dab9 (patch) | |
tree | 0d7c370a72bc0db3056af765da6fe5f670fb7f32 /main.go | |
parent | 14a8a232e78599caf8c037e85e2549b10951c1af (diff) |
more wip collect
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -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) } } |