@@ -24,7 +24,7 @@ module.exports = class extends Generator {
2424 this . description = {
2525 type : String ,
2626 alias : "d" ,
27- desc : "Command line app description (e.g. ) "
27+ desc : "Command line app description"
2828 } ;
2929
3030 this . argument ( "name" , this . name ) ;
@@ -37,24 +37,7 @@ module.exports = class extends Generator {
3737 prompting ( ) {
3838 this . log ( yosay ( "Welcome to the " + chalk . blue ( "node-cli-commander" ) + " generator!" ) ) ;
3939
40- const prompts = [ ] ;
41-
42- if ( ! this . options . description ) {
43- prompts . unshift ( {
44- type : "input" ,
45- name : "description" ,
46- message : this . description . desc ,
47- default : "Command line tool"
48- } ) ;
49- }
50-
51- if ( ! this . options . binName ) {
52- prompts . unshift ( {
53- type : "input" ,
54- name : "binName" ,
55- message : this . binName . desc
56- } ) ;
57- }
40+ let prompts = [ ] ;
5841
5942 if ( ! this . options . name ) {
6043 prompts . unshift ( {
@@ -66,9 +49,32 @@ module.exports = class extends Generator {
6649
6750 return this . prompt ( prompts ) . then ( answer => {
6851 this . name = this . options . name || answer . name ;
69- this . binName = this . options . binName || answer . binName ;
70- this . description = this . options . description || answer . description ;
7152 this . dir = this . name ;
53+
54+ prompts = [ ] ;
55+
56+ if ( ! this . options . description ) {
57+ prompts . unshift ( {
58+ type : "input" ,
59+ name : "description" ,
60+ message : this . description . desc ,
61+ default : "Command line tool"
62+ } ) ;
63+ }
64+
65+ if ( ! this . options . binName ) {
66+ prompts . unshift ( {
67+ type : "input" ,
68+ name : "binName" ,
69+ message : this . binName . desc ,
70+ default : this . name
71+ } ) ;
72+ }
73+
74+ return this . prompt ( prompts ) . then ( answer => {
75+ this . binName = this . options . binName || answer . binName ;
76+ this . description = this . options . description || answer . description ;
77+ } ) ;
7278 } ) ;
7379 }
7480
0 commit comments