|
@@ -3,6 +3,7 @@ package cli_options
|
|
|
import (
|
|
|
"errors"
|
|
|
|
|
|
+ "github.com/gravitl/netmaker/logger"
|
|
|
"github.com/gravitl/netmaker/netclient/command"
|
|
|
"github.com/gravitl/netmaker/netclient/config"
|
|
|
"github.com/urfave/cli/v2"
|
|
@@ -16,6 +17,7 @@ func GetCommands(cliFlags []cli.Flag) []*cli.Command {
|
|
|
Usage: "Join a Netmaker network.",
|
|
|
Flags: cliFlags,
|
|
|
Action: func(c *cli.Context) error {
|
|
|
+ parseVerbosity(c)
|
|
|
cfg, pvtKey, err := config.GetCLIConfig(c)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -39,6 +41,7 @@ func GetCommands(cliFlags []cli.Flag) []*cli.Command {
|
|
|
// the action, or code that will be executed when
|
|
|
// we execute our `ns` command
|
|
|
Action: func(c *cli.Context) error {
|
|
|
+ parseVerbosity(c)
|
|
|
cfg, _, err := config.GetCLIConfig(c)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -54,6 +57,7 @@ func GetCommands(cliFlags []cli.Flag) []*cli.Command {
|
|
|
// the action, or code that will be executed when
|
|
|
// we execute our `ns` command
|
|
|
Action: func(c *cli.Context) error {
|
|
|
+ parseVerbosity(c)
|
|
|
cfg, _, err := config.GetCLIConfig(c)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -69,6 +73,7 @@ func GetCommands(cliFlags []cli.Flag) []*cli.Command {
|
|
|
// the action, or code that will be executed when
|
|
|
// we execute our `ns` command
|
|
|
Action: func(c *cli.Context) error {
|
|
|
+ parseVerbosity(c)
|
|
|
cfg, _, err := config.GetCLIConfig(c)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -84,6 +89,7 @@ func GetCommands(cliFlags []cli.Flag) []*cli.Command {
|
|
|
// the action, or code that will be executed when
|
|
|
// we execute our `ns` command
|
|
|
Action: func(c *cli.Context) error {
|
|
|
+ parseVerbosity(c)
|
|
|
err := command.Uninstall()
|
|
|
return err
|
|
|
},
|
|
@@ -93,9 +99,23 @@ func GetCommands(cliFlags []cli.Flag) []*cli.Command {
|
|
|
Usage: "run netclient as daemon",
|
|
|
Flags: cliFlags,
|
|
|
Action: func(c *cli.Context) error {
|
|
|
+ // set max verbosity for daemon regardless
|
|
|
+ logger.Verbosity = 3
|
|
|
err := command.Daemon()
|
|
|
return err
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// == Private funcs ==
|
|
|
+
|
|
|
+func parseVerbosity(c *cli.Context) {
|
|
|
+ if c.Bool("v") {
|
|
|
+ logger.Verbosity = 1
|
|
|
+ } else if c.Bool("vv") {
|
|
|
+ logger.Verbosity = 2
|
|
|
+ } else if c.Bool("vvv") {
|
|
|
+ logger.Verbosity = 3
|
|
|
+ }
|
|
|
+}
|