Skip to content

Commit

Permalink
Overall verbosity improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
klaudiosinani committed Apr 17, 2020
1 parent 1db0d4f commit 603d904
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions src/rels.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,23 @@ class Rels {

_title(x) {
return [
`Release ${x.tag}`,
'*',
this._format.underline(`Release ${x.tag}`),
this._badges(x)
].join(' ');
}

_body(x) {
const body = [
`Assets: ${this._format.num(x.assets)}`,
`Downloads: ${this._format.num(x.dls)}`,
`Date: ${x.date}`,
`Author: @${x.author}`
];

return body.map(x => this._padding.concat(x, '\n')).join('');
}

_formatData(data) {
const result = [];

Expand Down Expand Up @@ -139,16 +151,12 @@ class Rels {
}

_displayRelease(x) {
const message = [
'',
`Assets: ${this._format.num(x.assets)}\n`,
`Downloads: ${this._format.num(x.dls)}\n`,
`Date: ${x.date}\n`,
`Author: @${x.author}\n`
];
const release = [
this._title(x),
this._body(x)
].join('\n');

log(this._title(x));
log(message.join(this._padding));
log(release);
}

_displayStats(data) {
Expand All @@ -165,17 +173,17 @@ class Rels {
].map(this._format.num);

const message = [
`In total: ${d} downloads, ${a} assets & ${r} releases.`,
`On average, each release receives ${dpr} downloads.`,
`Most popular release is ${pt} with ${pd} downloads.`,
`Latest release is ${lt} created on ${ld}.`
`Total: ${d} downloads, ${a} assets & ${r} releases.`,
`On average: ${dpr} downloads per release.`,
`Most popular: ${pt} with ${pd} downloads.`,
`Latest: ${lt} on ${ld}.`
];

log(message.join('\n'));
}

_display(repo, data, n) {
log(`\nLast ${n >= data.length ? data.length : n} releases of ${repo} repository:\n`);
log(`\nLast ${n >= data.length ? data.length : n} releases of ${this._format.underline(repo)} repository:\n`);

data.slice(0, n).reverse().forEach(x => {
this._displayRelease(x);
Expand Down

0 comments on commit 603d904

Please sign in to comment.