Skip to content

Commit bc2e8e5

Browse files
committed
fix: fix output of -v and -h flags
Closes #5
1 parent 7881c16 commit bc2e8e5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cli.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,22 @@ const cli = meow(`
5757

5858
updateNotifier({pkg}).notify();
5959

60+
if (cli.input.length === 0 && cli.flags.v === true) {
61+
cli.showVersion();
62+
}
63+
64+
if (cli.input.length === 0 && cli.flags.h === true) {
65+
cli.showHelp(0);
66+
}
67+
6068
if (cli.input.length !== 1) {
6169
console.log(`\n${logSymbols.error} Invalid input. Please check the help below:`);
6270
cli.showHelp();
6371
}
6472

6573
if (Object.keys(cli.flags).map(key => typeof cli.flags[key]).some(type => type === 'boolean')) {
6674
console.log(`\n${logSymbols.error} Wrong option(s) provided. Please check the help below:`);
67-
cli.showHelp(2);
75+
cli.showHelp();
6876
}
6977

7078
errorNotifier(cli.input[0], cli.flags)

0 commit comments

Comments
 (0)