Skip to content

Commit 4c2e393

Browse files
committed
👌 IMPROVE: Minimal
1 parent ae6f6fa commit 4c2e393

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"singleQuote": true,
44
"useTabs": true,
55
"tabWidth": 4,
6-
"semi": true
6+
"semi": true,
7+
"trailingComma": "none"
78
}

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const {
2424
colored,
2525
singleStates,
2626
coloredStates,
27-
borderless,
27+
borderless
2828
} = require('./utils/table.js');
2929
const xcolor = cli.flags.xcolor;
3030
const sortBy = cli.flags.sort;
@@ -56,5 +56,5 @@ const options = { sortBy, limit, reverse, minimal };
5656
await getStates(spinner, table, states, options);
5757
await getCountries(spinner, table, states, country, options);
5858

59-
!minimal && theEnd(lastUpdated, states);
59+
theEnd(lastUpdated, states, minimal);
6060
})();

utils/cli.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,28 @@ module.exports = meow(
3737
xcolor: {
3838
type: 'boolean',
3939
default: false,
40-
alias: 'x',
40+
alias: 'x'
4141
},
4242
sort: {
4343
type: 'string',
4444
default: 'cases',
45-
alias: 's',
45+
alias: 's'
4646
},
4747
reverse: {
4848
type: 'boolean',
4949
default: false,
50-
alias: 'r',
50+
alias: 'r'
5151
},
5252
limit: {
5353
type: 'number',
5454
default: Number.MAX_SAFE_INTEGER,
55-
alias: 'l',
55+
alias: 'l'
5656
},
5757
minimal: {
5858
type: 'boolean',
5959
defualt: false,
60-
alias: 'm',
61-
},
62-
},
60+
alias: 'm'
61+
}
62+
}
6363
}
6464
);

utils/getCountry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = async (spinner, table, states, countryName) => {
3434
comma(thisCountry.recovered),
3535
comma(thisCountry.active),
3636
comma(thisCountry.critical),
37-
comma(thisCountry.casesPerOneMillion),
37+
comma(thisCountry.casesPerOneMillion)
3838
]);
3939
spinner.stopAndPersist();
4040
console.log(table.toString());

utils/getWorldwide.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = async (table, states) => {
2020
data[2],
2121
`—`,
2222
`—`,
23-
`—`,
23+
`—`
2424
]);
2525
}
2626

utils/init.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ const welcome = require('cli-welcome');
22
const pkgJSON = require('./../package.json');
33
const updateNotifier = require('update-notifier');
44

5-
module.exports = async (quiet) => {
6-
if (quiet) return
5+
module.exports = async () => {
76
welcome(`corona-cli`, `by Awais.dev\n${pkgJSON.description}`, {
87
bgColor: `#007C91`,
98
color: `#FFFFFF`,
109
bold: true,
1110
clear: true,
12-
version: `v${pkgJSON.version}`,
11+
version: `v${pkgJSON.version}`
1312
});
1413
updateNotifier({
1514
pkg: pkgJSON,
1615
shouldNotifyInNpmScript: true,
17-
updateCheckInterval: 1000 * 60 * 60 * 24, // 24 hours.
16+
updateCheckInterval: 1000 * 60 * 60 * 24 // 24 hours.
1817
}).notify({ isGlobal: true });
1918
};

utils/table.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
`Recovered`,
1616
`Active`,
1717
`Critical`,
18-
`Per Million`,
18+
`Per Million`
1919
],
2020
colored: [
2121
`#`,
@@ -27,7 +27,7 @@ module.exports = {
2727
`${green(`Recovered`)}`,
2828
`${yellow(`Active`)}`,
2929
`${red(`Critical`)}`,
30-
`Per Million`,
30+
`Per Million`
3131
],
3232
singleStates: [
3333
`#`,
@@ -36,7 +36,7 @@ module.exports = {
3636
`Cases ${dim(`(today)`)}`,
3737
`Deaths`,
3838
`Deaths ${dim(`(today)`)}`,
39-
`Active`,
39+
`Active`
4040
],
4141
coloredStates: [
4242
`#`,
@@ -45,7 +45,7 @@ module.exports = {
4545
`Cases ${dim(`(today)`)}`,
4646
`${red(`Deaths`)}`,
4747
`${red(`Deaths (today)`)}`,
48-
`${yellow(`Active`)}`,
48+
`${yellow(`Active`)}`
4949
],
5050
style: { head: ['cyan'] },
5151
borderless: {
@@ -63,7 +63,7 @@ module.exports = {
6363
'mid-mid': '',
6464
right: '',
6565
'right-mid': '',
66-
middle: ' ',
66+
middle: ' '
6767
},
6868
sortingKeys: {
6969
country: 'country',
@@ -74,14 +74,14 @@ module.exports = {
7474
recovered: 'recovered',
7575
active: 'active',
7676
critical: 'critical',
77-
'per-million': 'casesPerOneMillion',
77+
'per-million': 'casesPerOneMillion'
7878
},
7979
sortingStateKeys: {
8080
state: 'state',
8181
cases: 'cases',
8282
'cases-today': 'todayCases',
8383
deaths: 'deaths',
8484
'deaths-today': 'todayDeaths',
85-
active: 'active',
86-
},
85+
active: 'active'
86+
}
8787
};

utils/theEnd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ ${dim(`❯ `)}${cyan(`Per Million:`)} Affected patients per million
3333
`)
3434
);
3535

36-
module.exports = async (lastUpdated, states, quiet) => {
37-
if (quiet) return
36+
module.exports = async (lastUpdated, states, minimal) => {
37+
if (minimal) return console.log();
3838
console.log(dim(`${sym.info} ${cyan(`Last Updated:`)} ${lastUpdated}`));
3939
states && infoStates();
4040
!states && infoCountries();

0 commit comments

Comments
 (0)