File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2- import promptConfig from './promptConfig' ;
2+ import chalk from 'chalk' ;
3+ import execa from 'execa' ;
4+ import inquirer from 'inquirer' ;
5+ import { config , choices , questions } from './promptConfig' ;
36
4- const cli = promptConfig ;
5- const config = cli . config ( ) ;
6- const choices = cli . choices ( config ) ;
7- const questions = cli . questions ( choices ) ;
7+ const configuration = config ( ) ;
8+ const choicesList = choices ( configuration ) ;
9+ const questionsList = questions ( choicesList ) ;
810
9- cli . prompt ( questions ) ;
11+ inquirer . prompt ( questionsList ) . then ( ( answers ) => {
12+ const message = answers . moreInfo ? `${ answers . editor } ` : `${ answers . type } ${ answers . description } ` ;
13+
14+ return execa ( 'git' , [ 'commit' , '-m' , message ] )
15+ . then ( result => console . log ( result . stdout ) )
16+ . catch ( ( err ) => {
17+ console . error ( chalk . red ( "Have you thought about 'git add' some files? Add files and try run following again:\n" ) ) ;
18+ console . error ( chalk . green ( err . cmd ) ) ;
19+ } ) ;
20+ } ) ;
You can’t perform that action at this time.
0 commit comments