forked from darcys22/godbledger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
66 lines (58 loc) · 1.37 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
59
60
61
62
63
64
65
66
package main
import (
"fmt"
"os"
"github.com/darcys22/godbledger/godbledger/cmd"
"github.com/urfave/cli/v2"
"github.com/sirupsen/logrus"
prefixed "github.com/x-cray/logrus-prefixed-formatter"
)
var app *cli.App
func init() {
customFormatter := new(prefixed.TextFormatter)
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
customFormatter.FullTimestamp = true
logrus.SetFormatter(customFormatter)
app = cli.NewApp()
app.Name = "Reporter"
app.Usage = "Extracts GL and TB reports from a Godbledger database"
app.Commands = []*cli.Command{
// transactionlisting.go
commandTransactionListing,
// trialbalance.go
commandTrialBalance,
// pdfgenerator.go
commandPDFGenerate,
}
app.Flags = []cli.Flag{
cmd.VerbosityFlag,
cmd.ConfigFileFlag,
cmd.RPCHost,
cmd.RPCPort,
cmd.CertFlag,
cmd.KeyFlag,
}
app.Action = reporterConsole
}
// Commonly used command line flags.
var (
csvFlag = &cli.StringFlag{
Name: "csv",
Usage: "output CSV instead of human-readable format",
}
jsonFlag = &cli.StringFlag{
Name: "json",
Usage: "output json instead of human-readable format",
}
formattingFlag = &cli.BoolFlag{
Name: "unformatted",
Aliases: []string{"u"},
Usage: "will display the dollar amounts without commas and dollar sign symbols",
}
)
func main() {
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}