Browse Source

alias: match hostname prefix without `.now.sh`

master
Guillermo Rauch 9 years ago
parent
commit
dbf56429bf
  1. 9
      lib/alias.js

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

Loading…
Cancel
Save