Skip to content

Commit

Permalink
added inquirer when creating new project
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottwik committed Jun 6, 2018
1 parent 5e2917d commit 0237032
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
30 changes: 26 additions & 4 deletions cli_commands/create.js
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)
})
}
}
1 change: 0 additions & 1 deletion libs/flat_db/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ flat.prototype.load = function (filename, is_full_absolute_path) {
fullpath_to_cms_file = filename
} else {
fullpath_to_cms_file = self.get_full_path_to_flat_object(filename)

}

// check if file exists. return empty object if not
Expand Down

0 comments on commit 0237032

Please sign in to comment.