From 231ad689346aa89a5535caeb85d8cddfd91fbd69 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Sun, 24 Apr 2016 01:51:16 +0300 Subject: [PATCH] Show url instead of deployment id in confirmation --- bin/now-remove | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/now-remove b/bin/now-remove index 8071e78..b5f1482 100755 --- a/bin/now-remove +++ b/bin/now-remove @@ -43,9 +43,9 @@ const hard = argv.hard || false; const config = cfg.read(); -function readConfirmation () { +function readConfirmation (url) { return new Promise((resolve, reject) => { - process.stdout.write(`${chalk.bold.red('> Are you sure?')} ${chalk.bold(deploymentId)} will be removed permanently ${chalk.gray('[yN] ')}`); + process.stdout.write(`${chalk.bold.red('> Are you sure?')} ${chalk.bold(url)} will be removed permanently ${chalk.gray('[yN] ')}`); process.stdin.on('data', (d) => { process.stdin.pause(); resolve(d.toString().trim()); @@ -70,9 +70,12 @@ Promise.resolve(config.token || login(apiUrl)) async function remove (token) { const now = new Now(apiUrl, token, { debug }); + const deployments = await now.list(); + const url = deployments.find((d) => d.uid === deploymentId).url; + try { - const confirmation = (await readConfirmation()).toLowerCase(); - if ('y' !== confirmation || 'yes' !== confirmation) { + const confirmation = (await readConfirmation(url)).toLowerCase(); + if ('y' !== confirmation && 'yes' !== confirmation) { console.log('> Aborted'); return; }