From 26afd83c1af236b9b067549a56c85e8185235b0b Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Thu, 8 Dec 2016 18:09:19 +0100 Subject: [PATCH] Ability to skip confirmation when deleting deployments --- bin/now-remove.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/now-remove.js b/bin/now-remove.js index 7873683..8abf396 100755 --- a/bin/now-remove.js +++ b/bin/now-remove.js @@ -14,12 +14,13 @@ import {handleError, error} from '../lib/error' const argv = minimist(process.argv.slice(2), { string: ['config', 'token'], - boolean: ['help', 'debug', 'hard'], + boolean: ['help', 'debug', 'hard', 'yes'], alias: { help: 'h', config: 'c', debug: 'd', - token: 't' + token: 't', + yes: 'y' } }) @@ -36,6 +37,7 @@ const help = () => { -c ${chalk.bold.underline('FILE')}, --config=${chalk.bold.underline('FILE')} Config file -d, --debug Debug mode [off] -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token + -y, --yes Skip confirmation ${chalk.dim('Examples:')} @@ -64,6 +66,7 @@ if (argv.help || ids.length === 0) { const debug = argv.debug const apiUrl = argv.url || 'https://api.zeit.co' const hard = argv.hard || false +const skipConfirmation = argv.yes || false if (argv.config) { cfg.setConfigFile(argv.config) @@ -147,10 +150,13 @@ async function remove(token) { } try { - const confirmation = (await readConfirmation(matches)).toLowerCase() - if (confirmation !== 'y' && confirmation !== 'yes') { - console.log('\n> Aborted') - process.exit(0) + if (!skipConfirmation) { + const confirmation = (await readConfirmation(matches)).toLowerCase() + + if (confirmation !== 'y' && confirmation !== 'yes') { + console.log('\n> Aborted') + process.exit(0) + } } const start = new Date()