-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.go
55 lines (46 loc) · 1.07 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
package main
import (
"os"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/longhorn/go-spdk-helper/app/cmd/advanced"
"github.com/longhorn/go-spdk-helper/app/cmd/basic"
"github.com/longhorn/go-spdk-helper/app/cmd/dmsetup"
"github.com/longhorn/go-spdk-helper/app/cmd/nvmecli"
"github.com/longhorn/go-spdk-helper/app/cmd/spdksetup"
"github.com/longhorn/go-spdk-helper/app/cmd/spdktgt"
)
func main() {
a := cli.NewApp()
a.Before = func(c *cli.Context) error {
if c.GlobalBool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
}
a.Flags = []cli.Flag{
cli.BoolFlag{
Name: "debug",
},
}
a.Commands = []cli.Command{
basic.BdevCmd(),
basic.BdevAioCmd(),
basic.BdevVirtioCmd(),
basic.BdevLvstoreCmd(),
basic.BdevLvolCmd(),
basic.BdevNvmeCmd(),
basic.BdevRaidCmd(),
basic.NvmfCmd(),
basic.LogCmd(),
advanced.DeviceCmd(),
advanced.ExposeCmd(),
nvmecli.Cmd(),
dmsetup.Cmd(),
spdktgt.Cmd(),
spdksetup.Cmd(),
}
if err := a.Run(os.Args); err != nil {
logrus.WithError(err).Fatal("Failed to execute command")
}
}