File tree Expand file tree Collapse file tree 1 file changed +18
-13
lines changed
Expand file tree Collapse file tree 1 file changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -10,21 +10,26 @@ async function askForCommitMessage() {
1010 output : process . stdout ,
1111 } ) ;
1212
13- rl . question ( `Suggested commit message: ${ prompt } \nDo you want to proceed? (y/n) ` , ( answer ) => {
14- if ( answer . toLowerCase ( ) === "y" ) {
15- execa ( "git" , [ "commit" , "-m" , prompt ] )
16- . then ( ( ) => {
17- console . log ( "Changes committed successfully!" ) ;
18- } )
19- . catch ( ( error ) => {
20- console . error ( "Failed to commit changes:" , error ) ;
21- } ) ;
22- } else {
23- console . log ( "Changes not committed." ) ;
24- }
13+ if ( prompt ) {
14+ rl . question ( `Suggested commit message: ${ prompt } \nDo you want to proceed? (y/n) ` , ( answer ) => {
15+ if ( answer . toLowerCase ( ) === "y" ) {
16+ execa ( "git" , [ "commit" , "-m" , prompt ] )
17+ . then ( ( ) => {
18+ console . log ( "Changes committed successfully!" ) ;
19+ } )
20+ . catch ( ( error ) => {
21+ console . error ( "Failed to commit changes:" , error ) ;
22+ } ) ;
23+ } else {
24+ console . log ( "Changes not committed." ) ;
25+ }
2526
27+ rl . close ( ) ;
28+ } ) ;
29+ } else {
30+ console . log ( "No changes to commit..." ) ;
2631 rl . close ( ) ;
27- } ) ;
32+ }
2833}
2934
3035export default askForCommitMessage ;
You can’t perform that action at this time.
0 commit comments