gosuki/cmd/config_commands.go

37 lines
606 B
Go
Raw Normal View History

2019-02-28 17:16:22 +00:00
package cmd
import (
2020-08-12 18:13:01 +00:00
"git.sp4ke.com/sp4ke/gomark/config"
"git.sp4ke.com/sp4ke/gomark/logging"
"git.sp4ke.com/sp4ke/gomark/utils"
2019-02-28 17:16:22 +00:00
2020-08-12 18:13:01 +00:00
"github.com/urfave/cli/v2"
2019-02-28 17:16:22 +00:00
)
var log = logging.GetLogger("CMD")
var cfgPrintCmd = &cli.Command{
2019-02-28 17:16:22 +00:00
Name: "print",
Aliases: []string{"p"},
Usage: "print current config",
Action: printConfig,
}
var ConfigCmds = &cli.Command{
2019-02-28 17:16:22 +00:00
Name: "config",
Usage: "get/set config opetions",
Subcommands: []*cli.Command{
2019-02-28 17:16:22 +00:00
cfgPrintCmd,
},
}
func printConfig(c *cli.Context) error {
2019-02-28 17:16:22 +00:00
err := utils.PrettyPrint(config.GetAll())
if err != nil {
return err
2019-02-28 17:16:22 +00:00
}
return nil
2019-02-28 17:16:22 +00:00
}