From 21bb73b3c8662827a04fb0038df451d9ae4e0b6e Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Mon, 30 May 2016 02:48:45 +0300 Subject: [PATCH] Basic `alias rm` --- lib/alias.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/alias.js b/lib/alias.js index 69c98c7..5c4976a 100644 --- a/lib/alias.js +++ b/lib/alias.js @@ -18,6 +18,21 @@ export default class Alias extends Now { return body.aliases; } + async rm (alias) { + const res = await this._fetch(`/now/aliases/${alias}`, { + method: 'DELETE' + }); + const body = await res.json(); + + if (res.status !== 200) { + const err = new Error('Deletion failed ' + body); + err.userError = true; + throw err; + } + + console.log(`${chalk.cyan('> Success!')}`); + } + async set (deployment, alias) { const list = await this.list(); let key, val;