File tree Expand file tree Collapse file tree 5 files changed +58
-10
lines changed
Expand file tree Collapse file tree 5 files changed +58
-10
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
2+ // import { argv } from 'yargs';
3+ import sgcPrompt from './sgcPrompt' ;
24
3- import { argv } from 'yargs' ;
4-
5- console . log ( argv ) ;
5+ sgcPrompt ( ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import chalk from 'chalk' ;
2+ import inquirer from 'inquirer' ;
3+ import getConfig from './getConfig' ;
4+
5+ const sgcPrompt = ( ) => {
6+ const config = getConfig ( ) ;
7+ const choices = [ ] ;
8+
9+ config . types . forEach ( ( type ) => {
10+ const emoji = `${ type . emoji } ` || '' ;
11+ const prefix = type . prefix ;
12+ const description = type . description || '' ;
13+
14+ choices . push ( {
15+ value : emoji + prefix ,
16+ name : `${ chalk . bold ( prefix ) } ${ description } ` ,
17+ } ) ;
18+ } ) ;
19+
20+ const questions = [ {
21+ type : 'list' ,
22+ name : 'type' ,
23+ message : 'Select the type of your commit:' ,
24+ choices,
25+ } , {
26+ type : 'input' ,
27+ name : 'description' ,
28+ message : 'Describe your commit message:' ,
29+ } , {
30+ type : 'confirm' ,
31+ name : 'moreInfo' ,
32+ message : 'You want to add more information to your commit?' ,
33+ default : false ,
34+ } , {
35+ type : 'editor' ,
36+ name : 'editor' ,
37+ message : 'this is the message' ,
38+ when : answers => answers . moreInfo ,
39+ default : answers => `${ answers . type } ${ answers . description } ` ,
40+ } ] ;
41+
42+ inquirer . prompt ( questions ) . then ( ( answers ) => {
43+ // TODO commit message
44+ console . log ( answers ) ;
45+ } ) ;
46+ } ;
47+
48+ export default sgcPrompt ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import test from 'ava' ;
2+ import prompt from '../lib/sgcPrompt' ;
3+
4+ test ( ( t ) => {
5+ prompt ( ) ;
6+ // t.true(prompt());
7+ } ) ;
You can’t perform that action at this time.
0 commit comments