Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "gump", Short: "Bump your project version into any file", Long: `Sometimes there is no easy way to update the references to your sofware version. Gump will do it for you! Given a simple configuration file (default is $PWD/gump.yml): version: 0.1.0 files: - path: file/test_files/yet-another-configuration-file.yml keys: - info.extra.version prefix: 'docker-image:' Just do gump If you need to bump your major version gump -M `, Run: func(cmd *cobra.Command, args []string) { // TODO: Use viper Get functions insead of hardcoding var locations []string version := viper.Get("version").(string) newVersion, err := bumpVersion(cmd, version) if err != nil { fmt.Println("error:", err) return } files := viper.Get("files").([]interface{}) for _, v := range files { var prefix string if infprefix := v.(map[interface{}]interface{})["prefix"]; infprefix != nil { prefix = infprefix.(string) } newVersionWithPrefix := prefix + newVersion ls := v.(map[interface{}]interface{})["keys"].([]interface{}) for i := 0; i < len(ls); i++ { locations = append(locations, ls[i].(string)) } f, err := file.Read(v.(map[interface{}]interface{})["path"].(string)) if err != nil { fmt.Println("error:", err) return } err = f.Modify(newVersionWithPrefix, locations) if err != nil { fmt.Println("error:", err) return } } newConf := &configuration.Configuration{} viper.Set("version", newVersion) viper.Unmarshal(newConf) err = newConf.Write(viper.ConfigFileUsed()) if err != nil { fmt.Println("error while updating the gump conf file") } }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.