Skip to content

Commit

Permalink
fix(cmd): commit preview confirmation behavior (#220)
Browse files Browse the repository at this point in the history
- Improve commit preview confirmation logic.
- Add option to skip confirmation for preview.

Signed-off-by: longkey1 <[email protected]>
  • Loading branch information
longkey1 authored Feb 13, 2025
1 parent db54ac5 commit 9208dcb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cmd/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,18 @@ var commitCmd = &cobra.Command{
return err
}

if preview && !noConfirm {
input := confirmation.New("Commit preview summary?", confirmation.Yes)
ready, err := input.RunPrompt()
if err != nil {
return err
}
if !ready {
if preview {
if noConfirm {
return nil
} else {
input := confirmation.New("Commit preview summary?", confirmation.Yes)
ready, err := input.RunPrompt()
if err != nil {
return err
}
if !ready {
return nil
}
}
}

Expand Down

0 comments on commit 9208dcb

Please sign in to comment.