refactor: allow for editing of amend commits

This commit is contained in:
Slug-Boi
2025-06-17 21:29:18 +02:00
parent 68024507e8
commit 70259d17f7
+3 -7
View File
@@ -24,7 +24,7 @@ var amendCmd = &cobra.Command{
pflag, _ := cmd.Flags().GetBool("print-output") pflag, _ := cmd.Flags().GetBool("print-output")
tflag, _ := cmd.Flags().GetBool("test_print") tflag, _ := cmd.Flags().GetBool("test_print")
git_flags, _ := cmd.Flags().GetString("git-flags") git_flags, _ := cmd.Flags().GetString("git-flags")
edit, _ := cmd.Flags().GetBool("edit") no_edit, _ := cmd.Flags().GetBool("no-edit")
hash, _ := cmd.Flags().GetString("hash") hash, _ := cmd.Flags().GetString("hash")
@@ -34,10 +34,6 @@ var amendCmd = &cobra.Command{
return return
} }
if edit {
}
var authors string var authors string
if len(args) == 0 { if len(args) == 0 {
// open the TUI to select co-authors // open the TUI to select co-authors
@@ -56,7 +52,7 @@ var amendCmd = &cobra.Command{
git_flags_split = strings.Split(git_flags, " ") git_flags_split = strings.Split(git_flags, " ")
} }
err, _ := utils.GitCommitAppender(authors, hash, git_flags_split, tflag, pflag) err, _ := utils.GitCommitAppender(authors, hash, git_flags_split, tflag, pflag, no_edit)
if err != nil { if err != nil {
println("Error amending commit:", err.Error()) println("Error amending commit:", err.Error())
os.Exit(1) os.Exit(1)
@@ -70,6 +66,6 @@ func init() {
amendCmd.Flags().StringP("git-flags", "g", "", "Git flags to add to the commit command") amendCmd.Flags().StringP("git-flags", "g", "", "Git flags to add to the commit command")
amendCmd.Flags().BoolP("print-output", "p", false, "Print the commit message to stdout") amendCmd.Flags().BoolP("print-output", "p", false, "Print the commit message to stdout")
amendCmd.Flags().BoolP("test_print", "t", false, "Print the commit message to stdout without amending") amendCmd.Flags().BoolP("test_print", "t", false, "Print the commit message to stdout without amending")
amendCmd.Flags().BoolP("edit", "e", false, "Edit the commit message in the editor") amendCmd.Flags().BoolP("no-edit", "n", false, "Do not edit the commit message in the editor")
amendCmd.Flags().StringP("hash", "s", "", "Hash of the commit to amend") amendCmd.Flags().StringP("hash", "s", "", "Hash of the commit to amend")
} }