Browse Source

Don't print the list if there is no entries

master
Olli Vanhoja 8 years ago
parent
commit
b98bc74f0b
  1. 2
      bin/now-alias
  2. 3
      bin/now-certs
  3. 2
      bin/now-domains
  4. 2
      bin/now-secrets

2
bin/now-alias

@ -127,7 +127,7 @@ async function run (token) {
const current = new Date();
const header = [['', 'id', 'source', 'url', 'created'].map(s => chalk.dim(s))];
const text = table(header.concat(aliases.map((_alias) => {
const text = 0 === list.length ? null : table(header.concat(aliases.map((_alias) => {
const _url = chalk.underline(`https://${_alias.alias}`);
const target = _alias.deploymentId;
const _sourceUrl = urls.get(target)

3
bin/now-certs

@ -113,6 +113,8 @@ async function run (token) {
const list = await certs.ls();
const elapsed = ms(new Date() - start);
console.log(`> ${list.length} certificate${list.length > 1 ? 's' : ''} found ${chalk.gray(`[${elapsed}]`)}`);
if (0 < list.length) {
const cur = Date.now();
list.sort((a, b) => {
return a.cn.localeCompare(b.cn);
@ -131,6 +133,7 @@ async function run (token) {
];
})), { align: ['l', 'r', 'l', 'l', 'l'], hsep: ' '.repeat(2), stringLength: strlen });
if (out) console.log('\n' + out + '\n');
}
} else if ('create' === subcommand) {
if (1 !== args.length) {
error(`Invalid number of arguments. Usage: ${chalk.cyan('`now certs create <cn>`')}`);

2
bin/now-domains

@ -129,7 +129,7 @@ async function run (token) {
domains.sort((a, b) => new Date(b.created) - new Date(a.created));
const current = new Date();
const header = [['', 'id', 'dns', 'url', 'created'].map(s => chalk.dim(s))];
const out = table(header.concat(domains.map((domain) => {
const out = domains.length === 0 ? null : table(header.concat(domains.map((domain) => {
const ns = domain.isExternal ? 'external' : 'zeit.world';
const url = chalk.underline(`https://${domain.name}`);
const time = chalk.gray(ms(current - new Date(domain.created)) + ' ago');

2
bin/now-secrets

@ -112,6 +112,7 @@ async function run (token) {
const list = await secrets.ls();
const elapsed = ms(new Date() - start);
console.log(`> ${list.length} secret${list.length > 1 ? 's' : ''} found ${chalk.gray(`[${elapsed}]`)}`);
if (0 < list.length) {
const cur = Date.now();
const header = [['', 'id', 'name', 'created'].map(s => chalk.dim(s))];
const out = table(header.concat(list.map((secret) => {
@ -123,6 +124,7 @@ async function run (token) {
];
})), { align: ['l', 'r', 'l', 'l'], hsep: ' '.repeat(2), stringLength: strlen });
if (out) console.log('\n' + out + '\n');
}
return secrets.close();
}

Loading…
Cancel
Save