Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NewConfigGetCmd = &cobra.Command{ Use: "get", Short: "Get tran configuration", Long: "Get tran configuration", RunE: func(cmd *cobra.Command, args []string) error { if err != nil { return err } viper.SetConfigType("yaml") viper.ReadConfig(bytes.NewBuffer(tranConfig)) fmt.Println(viper.Get("config." + args[0])) return nil }, }
View Source
var NewConfigListCmd = &cobra.Command{ Use: "list", Short: "List tran configuration", Long: "List tran configuration", RunE: func(cmd *cobra.Command, args []string) error { if err != nil { return err } viper.SetConfigType("yaml") viper.ReadConfig(bytes.NewBuffer(tranConfig)) config := viper.GetStringMap("config") for k, v := range config { fmt.Println(k+" =", v) } return nil }, }
View Source
var NewConfigSetCmd = &cobra.Command{ Use: "set", Short: "Update tran configuration", Long: "Update tran configuration, such as editor, show updates, etc.", RunE: func(cmd *cobra.Command, args []string) error { if err != nil { return err } viper.SetConfigType("yaml") viper.ReadConfig(bytes.NewBuffer(tranConfig)) viper.Set("config."+args[0], args[1]) err := viper.WriteConfigAs(tranConfigPath) if err != nil { return err } fmt.Println(ansi.Color("Updated tran configuration", "green")) return nil }, }
Functions ¶
func NewConfigCmd ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.