diff --git a/src/cli/lib/handle-create.mjs b/src/cli/lib/handle-create.mjs index f5d0c374..9e4c8db4 100644 --- a/src/cli/lib/handle-create.mjs +++ b/src/cli/lib/handle-create.mjs @@ -41,7 +41,7 @@ const handleCreate = async ({ argv, db }) => { } if (interrogationBundle.actions.length > 1) { const questioner = new Questioner({ interrogationBundle, output : progressLogger }) - await questioner.question() + await questioner.question(); ({ apexDomain = apexDomain, sourcePath = sourcePath } = questioner.values) } diff --git a/src/cli/lib/handle-destroy.mjs b/src/cli/lib/handle-destroy.mjs index 04a9d904..5beb550f 100644 --- a/src/cli/lib/handle-destroy.mjs +++ b/src/cli/lib/handle-destroy.mjs @@ -1,8 +1,8 @@ import commandLineArgs from 'command-line-args' +import { Questioner } from 'question-and-answer' import { cliSpec } from '../constants' import { destroy } from '../../lib/actions/destroy' -import { errorOut } from './error-out' import { getSiteInfo } from './get-site-info' import { progressLogger } from '../../lib/shared/progress-logger' @@ -10,12 +10,26 @@ const handleDestroy = async ({ argv, db }) => { const destroyOptionsSpec = cliSpec.commands.find(({ name }) => name === 'destroy').arguments const destroyOptions = commandLineArgs(destroyOptionsSpec, { argv }) const apexDomain = destroyOptions['apex-domain'] - const { confirmed } = destroyOptions + let { confirmed } = destroyOptions const siteInfo = getSiteInfo({ apexDomain, db }) if (confirmed !== true) { - errorOut("Interactive mode not yet implement. You must include the '--confirmed' option.\n", 3) + const interrogationBundle = { + actions : [{ + prompt : `Confirm destruction of '${apexDomain}'?`, + paramType : 'boolean', + parameter : 'confirmed' + }] + } + const questioner = new Questioner({ interrogationBundle, output : progressLogger }) + await questioner.question() + confirmed = questioner.getResult('confirmed').value + + if (confirmed !== true) { + progressLogger.write('Not confirmed; canceling operation.\n') + return + } } const deleted = await destroy({ db, siteInfo, verbose : true })