-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.go
69 lines (61 loc) · 2.47 KB
/
app.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
67
68
69
package veracity
import (
"fmt"
"github.com/urfave/cli/v2"
)
func NewApp(version string, ikwid bool) *cli.App {
cli.VersionPrinter = func(cCtx *cli.Context) {
fmt.Println(cCtx.App.Version)
}
app := &cli.App{
Name: "veracity",
Version: version,
Usage: "common read only operations on datatrails merklelog verifiable data",
Flags: []cli.Flag{
&cli.StringFlag{Name: "loglevel", Value: "NOOP"},
&cli.Int64Flag{Name: "height", Value: 14, Usage: "override the massif height"},
&cli.StringFlag{
Name: "data-url", Aliases: []string{"u"},
Usage: "url to download merkle log data from. mutually exclusive with data-local; if neither option is supplied, DataTrails' live log data will be used",
},
&cli.StringFlag{
Name: "data-local", Aliases: []string{"l"},
Usage: "filesystem location to load merkle log data from. can be a directory of massifs or a single file. mutually exclusive with data-url; if neither option is supplied, DataTrails' live log data will be used",
},
&cli.StringFlag{
Name: "tenant", Aliases: []string{"t"},
Usage: "tenant or list of tenants as a `,` separated list. commands which operate on a single tenant take the first tenant in the list",
},
},
}
if ikwid {
app.Flags = append(app.Flags, &cli.BoolFlag{
Name: "envauth", Usage: "set to enable authorization from the environment (not all commands support this)",
})
app.Flags = append(app.Flags, &cli.StringFlag{
Name: "account", Aliases: []string{"s"},
Usage: fmt.Sprintf("the azure storage account. defaults to `%s' and triggers use of emulator url", AzuriteStorageAccount),
})
app.Flags = append(app.Flags, &cli.StringFlag{
Name: "container", Aliases: []string{"c"},
Usage: "the azure storage container. this is necessary when using the azurite storage emulator",
Value: DefaultContainer,
})
}
return app
}
func AddCommands(app *cli.App, ikwid bool) *cli.App {
app.Commands = append(app.Commands, NewVerifyIncludedCmd())
app.Commands = append(app.Commands, NewNodeCmd())
app.Commands = append(app.Commands, NewLogWatcherCmd())
app.Commands = append(app.Commands, NewReplicateLogsCmd())
app.Commands = append(app.Commands, NewReceiptCmd())
if ikwid {
app.Commands = append(app.Commands, NewMassifsCmd())
app.Commands = append(app.Commands, NewLogTailCmd())
app.Commands = append(app.Commands, NewEventDiagCmd())
app.Commands = append(app.Commands, NewDiagCmd())
app.Commands = append(app.Commands, NewNodeScanCmd())
}
return app
}