feat: add git push flag to commands

This commit is contained in:
Slug-Boi
2024-12-14 00:09:59 +01:00
parent 8522fefa86
commit 33221e234b
3 changed files with 36 additions and 10 deletions
+8 -2
View File
@@ -23,9 +23,10 @@ This will require the user to have commitizen installed on their system.`,
var authors []string
// check if the print flag is set
pflag, _ := cmd.Flags().GetBool("print")
pflag, _ := cmd.Flags().GetBool("print-output")
cflag, _ := cmd.Flags().GetBool("cli")
gflag, _ := cmd.Flags().GetString("git")
gpflag, _ := cmd.Flags().GetBool("git-push")
// run execute commands again as root run will not call this part
message = utils.Cz_Call()
@@ -57,12 +58,17 @@ This will require the user to have commitizen installed on their system.`,
if pflag {
fmt.Println(message)
}
if gpflag {
utils.GitPush()
}
},
}
func init() {
rootCmd.AddCommand(czCmd)
czCmd.Flags().StringP("git", "g", "", "Passes the flags specified to the git command")
czCmd.Flags().BoolP("print", "p", false, "Print the commit message")
czCmd.Flags().BoolP("print-output", "o", false, "Print the commit message")
czCmd.Flags().BoolP("cli", "c", false, "[co-author1] [co-author2] ...")
czCmd.Flags().BoolP("git-push", "p", false, "Runs the git push command after the commit")
}