@@ -24,6 +24,7 @@ exports.Template = Object.create(PackageTemplate, {
2424 value :function ( command ) {
2525 command = PackageTemplate . addOptions . call ( this , command ) ;
2626 command . option ( '-n, --name <name>' , 'application name (required)' ) ;
27+ command . option ( '-d, --description <description>' , 'application description (optional)' ) ;
2728 command . option ( '-c, --copyright [path]' , 'copyright file' ) ;
2829 return command ;
2930 }
@@ -32,10 +33,16 @@ exports.Template = Object.create(PackageTemplate, {
3233 didSetOptions : {
3334 value :function ( options ) {
3435 if ( options . name ) {
36+ options . originalName = options . name ;
3537 options . name = this . validateName ( options . name ) ;
3638 } else {
3739 throw new ArgumentError ( "Required name option missing" ) ;
3840 }
41+ if ( options . description ) {
42+ options . description = this . validateDescription ( options . description ) ;
43+ } else {
44+ options . description = options . originalName + " Application" ;
45+ }
3946 if ( options . copyright ) {
4047 options . copyright = this . validateCopyright ( options . copyright ) ;
4148 }
@@ -52,6 +59,13 @@ exports.Template = Object.create(PackageTemplate, {
5259 }
5360 } ,
5461
62+ validateDescription : {
63+ value : function ( description ) {
64+ // ensure names are safe to use as npm package names
65+ return removeDiacritics ( description ) ;
66+ }
67+ } ,
68+
5569 validateCopyright : {
5670 value : function ( path ) {
5771 return fs . readFileSync ( path , "utf-8" ) ;
@@ -63,6 +77,4 @@ exports.Template = Object.create(PackageTemplate, {
6377 return process . cwd ( ) ;
6478 }
6579 }
66-
67-
6880} ) ;
0 commit comments