Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "version-bump", Short: "Bumb & commit version of (SL) Go application", Aliases: []string{"vb"}, Args: cobra.NoArgs, Run: func(c *cobra.Command, args []string) { version_go_file := `package version var Version string = "` + CmdFlagVersion + `" ` err := os.WriteFile("version/version.go", []byte(version_go_file), 0644) if err != nil { panic(err) } if CmdFlagNoCommit { return } var r *git.Repository var commit plumbing.Hash if !CmdFlagGoGit { err = exec_utils.ExecOut("git", "add", "version/version.go") if err != nil { log.Fatalln(err) } err = exec_utils.ExecOut("git", "commit", "-m", "VERSION: "+CmdFlagVersion) if err != nil { log.Fatalln(err) } } else { r, err = git.PlainOpen(".") if err != nil { panic(err) } w, err := r.Worktree() if err != nil { panic(err) } _, err = w.Add("version/version.go") if err != nil { panic(err) } commit, _ = w.Commit("VERSION: "+CmdFlagVersion, &git.CommitOptions{}) _, err = r.CommitObject(commit) if err != nil { panic(err) } } if !CmdFlagGoGit { if CmdFlagTag { err = exec_utils.ExecOut("git", "tag", CmdFlagVersion, "-m", "VERSION: "+CmdFlagVersion) if err != nil { log.Fatalln(err) } } } else { if CmdFlagTag { _, err := r.CreateTag( CmdFlagVersion, commit, &git.CreateTagOptions{ Message: "VERSION: " + CmdFlagVersion, }, ) if err != nil { panic(err) } } } }, }
View Source
var CmdFlagGoGit bool
View Source
var CmdFlagNoCommit bool
View Source
var CmdFlagTag bool
View Source
var CmdFlagVersion string
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.