From 6dcd7b68dda5e4bd8cc06f87a5c40f3ca30b1b72 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Fri, 10 Jun 2016 15:04:26 -0700 Subject: [PATCH] now-alias: fix edge case with older aliases or removed deployments --- bin/now-alias | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/now-alias b/bin/now-alias index 809be5a..d792425 100755 --- a/bin/now-alias +++ b/bin/now-alias @@ -128,9 +128,19 @@ async function run (token) { const text = sorted.map(([target, _aliases]) => { return table(_aliases.map((_alias) => { const _url = chalk.underline(`https://${_alias.alias}`); - const _sourceUrl = chalk.underline(`https://${urls.get(target)}`); + const _sourceUrl = urls.get(target) + ? chalk.underline(`https://${urls.get(target)}`) + : chalk.gray(''); + const time = chalk.gray(ms(current - new Date(_alias.created)) + ' ago'); - return [_alias.uid, _sourceUrl, _url, time]; + return [ + // we default to `''` because some early aliases didn't + // have an uid associated + null == _alias.uid ? '' : _alias.uid, + _sourceUrl, + _url, + time + ]; }), { align: ['l', 'r', 'l'], hsep: ' '.repeat(3) }); }).join('\n\n');