-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (43 loc) · 850 Bytes
/
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
package main
import (
"github.com/tiennampham23/berachain-airdrop/cmd/bot"
"github.com/tiennampham23/berachain-airdrop/pkg/log"
"github.com/urfave/cli/v2"
"os"
)
const (
relativePathFlag = "relative-path"
)
func main() {
app := cli.App{
Commands: []*cli.Command{
{
Name: "run",
Aliases: []string{},
Action: run,
Flags: flags(),
},
}}
err := app.Run(os.Args)
if err != nil {
log.Logger().Fatalw("Failed to run this service", "err", err)
}
}
func run(c *cli.Context) error {
relativePath := c.String(relativePathFlag)
b, err := bot.NewBot(relativePath)
if err != nil {
return err
}
return b.Start()
}
func flags() []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: relativePathFlag,
EnvVars: []string{"RELATIVE_PATH"},
Required: true,
Aliases: []string{"f"},
},
}
}