-
Notifications
You must be signed in to change notification settings - Fork 1
/
ndnetcli.go
45 lines (38 loc) · 863 Bytes
/
ndnetcli.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
package ndnetcli
import (
"fmt"
"github.com/urfave/cli"
)
func NdnetCmdNotFound(c *cli.Context, command string) {
fmt.Println(command, " not found ");
}
func NdnetInitialize(c *cli.Context) error {
cfgFile := c.GlobalString("config")
fmt.Println(cfgFile)
if cfgFile != "" {
// fmt.Println("Found config: ", cfgFile);
}
return nil
}
func NewCli(version string) *cli.App {
app := cli.NewApp()
app.Name = "ndnet"
app.Version = version
app.Author = "nexentaedge@nexenta.com"
app.Usage = "CLI for nexenta edge networking"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "loglevel",
Value: "info",
Usage: "Specifies the logging level (debug|warning|error)",
EnvVar: "LogLevel",
},
}
app.CommandNotFound = NdnetCmdNotFound
app.Before = NdnetInitialize
app.Commands = []cli.Command{
DaemonCmd,
NetworkCmd,
}
return app
}