Skip to content

Commit 9208dcb

Browse files
authored
fix(cmd): commit preview confirmation behavior (#220)
- Improve commit preview confirmation logic. - Add option to skip confirmation for preview. Signed-off-by: longkey1 <[email protected]>
1 parent db54ac5 commit 9208dcb

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

cmd/commit.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,18 @@ var commitCmd = &cobra.Command{
291291
return err
292292
}
293293

294-
if preview && !noConfirm {
295-
input := confirmation.New("Commit preview summary?", confirmation.Yes)
296-
ready, err := input.RunPrompt()
297-
if err != nil {
298-
return err
299-
}
300-
if !ready {
294+
if preview {
295+
if noConfirm {
301296
return nil
297+
} else {
298+
input := confirmation.New("Commit preview summary?", confirmation.Yes)
299+
ready, err := input.RunPrompt()
300+
if err != nil {
301+
return err
302+
}
303+
if !ready {
304+
return nil
305+
}
302306
}
303307
}
304308

0 commit comments

Comments
 (0)