Browse Source

Added `--safe` flag for skipping aliased deployments (#617)

master
Albert Martin 8 years ago
committed by Leo Lamprecht
parent
commit
3b11fd1d7e
  1. 9
      bin/now-remove.js

9
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`

Loading…
Cancel
Save