@@ -25,12 +25,26 @@ program
2525 . version ( '1.0.0' )
2626 . command ( 'create' )
2727 . description ( 'Create a new project from a git template' )
28- . argument ( '< project-directory> ' , 'The directory to create the project in' )
28+ . argument ( '[ project-directory] ' , 'The directory to create the project in' )
2929 . argument ( '[template-name]' , 'The name of the template to use' )
3030 . option ( '-t, --template-file <path>' , 'Path to a JSON file with custom templates (same format as built-in)' )
31+ . option ( '--ssh' , 'Use SSH URL for cloning the template repository' )
3132 . action ( async ( projectDirectory , templateName , options ) => {
3233 const templatesToUse = mergeTemplates ( defaultTemplates , options ?. templateFile ) ;
3334
35+ // If project directory is not provided, prompt for it
36+ if ( ! projectDirectory ) {
37+ const projectDirAnswer = await inquirer . prompt ( [
38+ {
39+ type : 'input' ,
40+ name : 'projectDirectory' ,
41+ message : 'Please provide the directory where you want to create the project?' ,
42+ default : 'my-app' ,
43+ } ,
44+ ] ) ;
45+ projectDirectory = projectDirAnswer . projectDirectory ;
46+ }
47+
3448 // If template name is not provided, show available templates and let user select
3549 if ( ! templateName ) {
3650 console . log ( '\n📋 Available templates:\n' ) ;
@@ -66,8 +80,22 @@ program
6680 console . log ( '' ) ;
6781 process . exit ( 1 ) ;
6882 }
69-
70- const templateRepoUrl = template . repo ;
83+
84+ // If --ssh was not passed, prompt whether to use SSH
85+ let useSSH = options ?. ssh ;
86+ if ( useSSH === undefined && template . repoSSH ) {
87+ const sshAnswer = await inquirer . prompt ( [
88+ {
89+ type : 'confirm' ,
90+ name : 'useSSH' ,
91+ message : 'Use SSH URL for cloning?' ,
92+ default : false ,
93+ } ,
94+ ] ) ;
95+ useSSH = sshAnswer . useSSH ;
96+ }
97+
98+ const templateRepoUrl = useSSH && template . repoSSH ? template . repoSSH : template . repo ;
7199
72100 // Define the full path for the new project
73101 const projectPath = path . resolve ( projectDirectory ) ;
@@ -93,25 +121,25 @@ program
93121 {
94122 type : 'input' ,
95123 name : 'name' ,
96- message : 'Project name?' ,
124+ message : 'What is the project name?' ,
97125 default : path . basename ( projectPath ) ,
98126 } ,
99127 {
100128 type : 'input' ,
101129 name : 'version' ,
102- message : 'Version ?' ,
130+ message : 'What version number would you like to use ?' ,
103131 default : '1.0.0' ,
104132 } ,
105133 {
106134 type : 'input' ,
107135 name : 'description' ,
108- message : 'Description ?' ,
136+ message : 'What is the project description ?' ,
109137 default : '' ,
110138 } ,
111139 {
112140 type : 'input' ,
113141 name : 'author' ,
114- message : 'Author ?' ,
142+ message : 'Who is the author of the project ?' ,
115143 default : '' ,
116144 } ,
117145 ] ;
0 commit comments