Skip to content

Commit

Permalink
feat: add --all flag to av commit amend (#452)
Browse files Browse the repository at this point in the history
Adds the --flag to `av commit amend` to match `av commit create`
  • Loading branch information
dacuna-ic authored Nov 11, 2024
1 parent ed184fe commit 7e092e5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/av/commit_amend.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ var commitAmendFlags struct {

// Same as `git commit --amend --no-edit`. Amends a commit without changing its commit message.
NoEdit bool

// Same as `git commit --all`.
All bool
}

var commitAmendCmd = &cobra.Command{
Expand Down Expand Up @@ -56,6 +59,9 @@ func runAmend(repo *git.Repo, db meta.DB) error {
if commitAmendFlags.NoEdit {
commitArgs = append(commitArgs, "--no-edit")
}
if commitAmendFlags.All {
commitArgs = append(commitArgs, "--all")
}
if commitAmendFlags.Message != "" {
commitArgs = append(commitArgs, "--message", commitAmendFlags.Message)
}
Expand Down Expand Up @@ -89,4 +95,6 @@ func init() {
commitAmendCmd.Flags().
BoolVar(&commitAmendFlags.NoEdit, "no-edit", false, "amend a commit without changing its commit message")
commitAmendCmd.MarkFlagsMutuallyExclusive("message", "no-edit")
commitAmendCmd.Flags().
BoolVarP(&commitAmendFlags.All, "all", "a", false, "automatically stage modified files (same as git commit --all)")
}

0 comments on commit 7e092e5

Please sign in to comment.