From 35ceb7e01dd2c07f2eda4ca63224993086e749f9 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Thu, 21 May 2020 11:55:56 +0100 Subject: [PATCH] budi init - removing unnecessary argument --- packages/cli/src/commands/init/index.js | 9 +------ packages/cli/src/commands/init/initHandler.js | 26 +++---------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/packages/cli/src/commands/init/index.js b/packages/cli/src/commands/init/index.js index 4a25fbd8b2..f387a8d203 100644 --- a/packages/cli/src/commands/init/index.js +++ b/packages/cli/src/commands/init/index.js @@ -11,13 +11,6 @@ module.exports = { default: "~/.budibase", alias: "d", }) - yargs.positional("database", { - type: "string", - describe: "use a local (PouchDB) or remote (CouchDB) database", - alias: "b", - default: "local", - choices: ["local", "remote"], - }) yargs.positional("clientId", { type: "string", describe: "used to determine the name of the global databse", @@ -28,7 +21,7 @@ module.exports = { type: "string", describe: "connection string for couch db, format: https://username:password@localhost:5984", - alias: "x", + alias: "u", default: "", }) yargs.positional("quiet", { diff --git a/packages/cli/src/commands/init/initHandler.js b/packages/cli/src/commands/init/initHandler.js index 0467633ee8..c0c4ad1b9e 100644 --- a/packages/cli/src/commands/init/initHandler.js +++ b/packages/cli/src/commands/init/initHandler.js @@ -14,7 +14,6 @@ const run = async opts => { try { await ensureAppDir(opts) await setEnvironmentVariables(opts) - await prompts(opts) await createClientDatabase(opts) await createDevEnvFile(opts) console.log(chalk.green("Budibase successfully initialised.")) @@ -24,13 +23,13 @@ const run = async opts => { } const setEnvironmentVariables = async opts => { - if (opts.database === "local") { + if (opts.couchDbUrl) { + process.env.COUCH_DB_URL = opts.couchDbUrl + } else { const dataDir = join(opts.dir, ".data") await ensureDir(dataDir) process.env.COUCH_DB_URL = dataDir + (dataDir.endsWith("/") || dataDir.endsWith("\\") ? "" : "/") - } else { - process.env.COUCH_DB_URL = opts.couchDbUrl } } @@ -39,25 +38,6 @@ const ensureAppDir = async opts => { await ensureDir(opts.dir) } -const prompts = async opts => { - const questions = [ - { - type: "input", - name: "couchDbUrl", - message: - "CouchDB Connection String (e.g. https://user:password@localhost:5984): ", - validate: function(value) { - return !!value || "Please enter connection string" - }, - }, - ] - - if (opts.database === "remote" && !opts.couchDbUrl) { - const answers = await inquirer.prompt(questions) - opts.couchDbUrl = answers.couchDbUrl - } -} - const createClientDatabase = async opts => { // cannot be a top level require as it // will cause environment module to be loaded prematurely