mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: allow for editing of amend commits
This commit is contained in:
+3
-7
@@ -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")
|
||||||
|
|
||||||
|
|
||||||
@@ -33,10 +33,6 @@ var amendCmd = &cobra.Command{
|
|||||||
hash = ""
|
hash = ""
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if edit {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var authors string
|
var authors string
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
@@ -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")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user