-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added inquirer when creating new project
- Loading branch information
Showing
2 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
// global dependencies | ||
const inquirer = require('inquirer') | ||
|
||
module.exports = { | ||
command: 'create <project_name> [scaffolding_name]', | ||
command: 'create [project_name] [scaffolding_name]', | ||
desc: 'creates new enduro.js project', | ||
builder: (yargs) => { | ||
return yargs | ||
.usage('enduro create <project_name>') | ||
.example('enduro create my_cool_project') | ||
}, | ||
handler: function (cli_arguments) { | ||
const enduro_instance = require('../index').init() | ||
.then(() => { | ||
return enduro.actions.create(cli_arguments.project_name, cli_arguments.scaffolding_name) | ||
|
||
let project_name = cli_arguments.project_name | ||
// if no project name is given | ||
let all_arguments_given = Promise.resolve(); | ||
if (!project_name) { | ||
all_arguments_given = inquirer.prompt([ | ||
{ | ||
name: 'project_name', | ||
message: 'Project name', | ||
type: 'input', | ||
}, | ||
]) | ||
.then((answers) => { | ||
project_name = answers.project_name | ||
}) | ||
} | ||
|
||
all_arguments_given.then(() => { | ||
return require('../index').init() | ||
}) | ||
.then(() => { | ||
return enduro.actions.create(project_name, cli_arguments.scaffolding_name) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters