Browse Source

Show url instead of deployment id in confirmation

master
Tony Kovanen 9 years ago
parent
commit
231ad68934
  1. 11
      bin/now-remove

11
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;
}

Loading…
Cancel
Save