Skip to content

Commit 89e02e3

Browse files
committed
Add 'config' command to start interacting with zb configuration
Make it easier to verify what configuration 'zb' is using.
1 parent 024f293 commit 89e02e3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

cmd/config.go

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package cmd
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
7+
"github.com/spf13/cobra"
8+
"github.com/spf13/viper"
9+
)
10+
11+
var configCmd = &cobra.Command{
12+
Use: "config",
13+
Short: "Get and set configuration options",
14+
Run: func(cmd *cobra.Command, args []string) {
15+
jsonStr, _ := json.MarshalIndent(viper.AllSettings(), "", " ")
16+
fmt.Println(string(jsonStr))
17+
},
18+
}
19+
20+
func init() {
21+
rootCmd.AddCommand(configCmd)
22+
}

0 commit comments

Comments
 (0)