summaryrefslogtreecommitdiff
path: root/exit.go
blob: 5c8047d2ff913153fb7a98cfe000308b250914e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package prep

import (
	"os"
	"time"

	"go.wit.com/lib/gui/shell"
	"go.wit.com/log"
)

// initializes logging and command line options

func (pb *Auto) GoodExit(msg string) {
	dur := time.Since(pb.Ctime.AsTime())
	log.Infof("%s: %s (%s)\n", pb.Argname, msg, shell.FormatDuration(dur))
	os.Exit(0)
}

func (pb *Auto) BadExit(msg string, err error) {
	if err != nil {
		log.Info(err)
	}
	dur := time.Since(pb.Ctime.AsTime())
	log.Infof("%s: %s (%s)\n", pb.Argname, msg, shell.FormatDuration(dur))
	os.Exit(-1)
}