From 3b11fd1d7ea3882bb480f370e06f97a59261cc2e Mon Sep 17 00:00:00 2001 From: Albert Martin Date: Sat, 3 Jun 2017 09:40:18 -0500 Subject: [PATCH] Added `--safe` flag for skipping aliased deployments (#617) --- bin/now-remove.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/now-remove.js b/bin/now-remove.js index bb180fc..3e20c5d 100755 --- a/bin/now-remove.js +++ b/bin/now-remove.js @@ -16,7 +16,7 @@ const { normalizeURL } = require('../lib/utils/url') const argv = minimist(process.argv.slice(2), { string: ['config', 'token'], - boolean: ['help', 'debug', 'hard', 'yes'], + boolean: ['help', 'debug', 'hard', 'yes', 'safe'], alias: { help: 'h', config: 'c', @@ -40,6 +40,7 @@ const help = () => { -d, --debug Debug mode [off] -t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline('TOKEN')} Login token -y, --yes Skip confirmation + --safe Skip deployments with an active alias ${chalk.dim('Examples:')} @@ -109,8 +110,12 @@ function readConfirmation(matches) { ) process.stdout.write(tbl + '\n') - for (const depl of matches) { + for (const [index, depl] of matches.entries()) { for (const alias of depl.aliases) { + if (argv.safe) { + delete matches[index] + continue + } process.stdout.write( `> ${chalk.yellow('Warning!')} Deployment ${chalk.bold(depl.uid)} ` + `is an alias for ${chalk.underline(`https://${alias.alias}`)} and will be removed.\n`