File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 11import chalk from 'chalk' ;
2+ import execa from 'execa' ;
23import inquirer from 'inquirer' ;
34import getConfig from './getConfig' ;
45
6+ const cwd = process . cwd ( ) ;
7+
58const sgcPrompt = ( ) => {
69 const config = getConfig ( ) ;
710 const choices = [ ] ;
@@ -34,14 +37,20 @@ const sgcPrompt = () => {
3437 } , {
3538 type : 'editor' ,
3639 name : 'editor' ,
37- message : 'this is the message ' ,
40+ message : 'This will let you add more information ' ,
3841 when : answers => answers . moreInfo ,
39- default : answers => `${ answers . type } ${ answers . description } ` ,
42+ default : answers => `${ answers . type } ${ answers . description } \n\n\n ` ,
4043 } ] ;
4144
4245 inquirer . prompt ( questions ) . then ( ( answers ) => {
43- // TODO commit message
44- console . log ( answers ) ;
46+ const message = answers . moreInfo ? `"${ answers . editor } "` : `"${ answers . type } ${ answers . description } "` ;
47+
48+ execa ( 'git' , [ 'commit' , '-m' , message ] )
49+ . then ( ( result ) => console . log ( process . stdout ) )
50+ . catch ( ( err ) => {
51+ console . error ( chalk . red ( "Have you thought about 'git add' some files? Add files and try run following again:\n" ) ) ;
52+ console . error ( chalk . green ( err . cmd ) )
53+ } ) ;
4554 } ) ;
4655} ;
4756
You can’t perform that action at this time.
0 commit comments