Skip to content

Commit

Permalink
fix(cli): botpress init --yes inits bot in current dir (resolve #623)
Browse files Browse the repository at this point in the history
  • Loading branch information
epaminond committed Jun 24, 2018
1 parent 50f1052 commit 50a1d3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/core/botpress/src/cli/index.js
Expand Up @@ -13,8 +13,8 @@ import cloudPair from './cloudPair'
import { getBotpressVersion, collectArgs } from '../util'

program
.command('init')
.description('Create a new bot in current directory')
.command('init [dirName]')
.description('Create a new bot in new directory (or in current directory if not provided)')
.option('-y, --yes', 'Say yes to every prompt and use default values')
.action(init)

Expand Down
5 changes: 2 additions & 3 deletions packages/core/botpress/src/cli/init.js
Expand Up @@ -111,12 +111,11 @@ const generate = async result => {
console.log(nextStepText)
}

module.exports = async program => {
module.exports = async (dirName, { yes }) => {
console.log(introductionText)

// People can optionally provide the directory of the bot
// Like "bp init my-bot"
const dirName = process.argv[3]
if (dirName) {
if (!fs.existsSync(dirName)) {
fs.mkdirSync(dirName)
Expand Down Expand Up @@ -162,7 +161,7 @@ module.exports = async program => {
}
}

if (program.yes) {
if (yes) {
generate({
name: defaultBotName,
version: botpressVersion,
Expand Down

0 comments on commit 50a1d3a

Please sign in to comment.