-
Notifications
You must be signed in to change notification settings - Fork 32
/
cmd.go
34 lines (29 loc) · 977 Bytes
/
cmd.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
// Package cmd provides the command line interface for the screener-api.
package cmd
import (
"fmt"
"github.com/synapsecns/sanguine/core/commandline"
"github.com/synapsecns/sanguine/core/config"
"github.com/synapsecns/sanguine/core/metrics"
"github.com/urfave/cli/v2"
)
// Start starts the command line tool.
func Start(args []string, buildInfo config.BuildInfo) {
app := cli.NewApp()
app.Name = buildInfo.Name()
app.Description = buildInfo.VersionString() + "Screener API is a tool to screen and split data."
app.Usage = fmt.Sprintf("%s --help", buildInfo.Name())
app.EnableBashCompletion = true
app.Before = func(c *cli.Context) error {
// nolint:wrapcheck
return metrics.Setup(c.Context, buildInfo)
}
app.Commands = cli.Commands{screenerCommand}
shellCommand := commandline.GenerateShellCommand(app.Commands)
app.Commands = append(app.Commands, shellCommand)
app.Action = shellCommand.Action
err := app.Run(args)
if err != nil {
panic(err)
}
}