diff --git a/lib/alias.js b/lib/alias.js index 5f510c7..82bfa56 100644 --- a/lib/alias.js +++ b/lib/alias.js @@ -1,6 +1,7 @@ import retry from 'async-retry'; import Now from '../lib'; import toHost from './to-host'; +import chalk from 'chalk'; export default class Alias extends Now { @@ -48,10 +49,14 @@ export default class Alias extends Now { key = 'uid'; } - const id = list.find((d) => d[key] === val); + const id = list.find((d) => { + return d[key] === val || // match entire host / uid + // match prefix + val + '.now.sh' === d.url; + }); if (!id) { - const err = new Error(`Deployment not found by ${key} "${deployment}"`); + const err = new Error(`Deployment not found by "${deployment}". Run ${chalk.dim('`now ls`')} to see your deployments.`); err.userError = true; throw err; }