-
Notifications
You must be signed in to change notification settings - Fork 47
/
main.go
58 lines (47 loc) · 1.08 KB
/
main.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT License was not distributed with this
// file, you can obtain one at https://opensource.org/licenses/MIT.
//
// Copyright (c) DUSK NETWORK. All rights reserved.
package main
import (
"fmt"
"os"
"time"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var (
log *logrus.Entry
app = cli.NewApp()
)
func initLog() {
log = logrus.WithFields(logrus.Fields{
"app": "voucher",
"prefix": "main",
})
}
func init() {
initLog()
app.Action = action
app.Copyright = "Copyright (c) 2020 DUSK"
app.Name = "voucher"
app.Usage = "Official Voucher command-line interface"
app.Author = "DUSK 2020"
app.Version = "0.0.1"
app.Commands = []cli.Command{}
app.Flags = append(app.Flags, CLIFlags...)
}
func main() {
defer handlePanic()
if err := app.Run(os.Args); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func handlePanic() {
if r := recover(); r != nil {
log.WithError(fmt.Errorf("%+v", r)).Errorln("Application Voucher panic")
}
time.Sleep(time.Second * 1)
}