| 23 | ) |
| 24 | |
| 25 | func newConfigViewCmd() *cobra.Command { |
| 26 | cmd := &cobra.Command{ |
| 27 | Use: "view", |
| 28 | Short: "View the current CLI configuration", |
| 29 | Annotations: map[string]string{ |
| 30 | skipActionOptsInit: trueString, |
| 31 | }, |
| 32 | Run: func(cmd *cobra.Command, args []string) { |
| 33 | fmt.Printf("Config file: %s\n", viper.ConfigFileUsed()) |
| 34 | |
| 35 | for _, opt := range []*confOpt{confOptions.controlplaneAPI, confOptions.controlplaneCA, confOptions.CASAPI, confOptions.CASCA} { |
| 36 | if v := viper.GetString(opt.viperKey); v != "" { |
| 37 | fmt.Printf("%s: %s\n", opt.flagName, v) |
| 38 | } |
| 39 | } |
| 40 | }, |
| 41 | } |
| 42 | |
| 43 | return cmd |
| 44 | } |