Skip to content

Commit 2c35957

Browse files
committed
✨ feat: show help when no command specified
1 parent 48daee4 commit 2c35957

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

cli/index.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,21 @@ const showHelp = () => {
3636
}
3737

3838
const [command] = options._;
39-
if(command === 'help') {
39+
if(command === 'help' || !command) {
4040
showHelp();
4141
process.exit(0);
4242
}
4343

44-
if (command) {
45-
if(options.help) {
46-
console.info(HELP_COMMANDS[command]);
47-
process.exit(0);
48-
}
49-
scripts[command](options).then(() => {
50-
console.info(`"${command}" command run successfully.`);
51-
process.exit(0);
52-
}).catch((error) => {
53-
console.error(error, `An error has occured while running command (${command}).`);
54-
process.exit(1);
55-
});
44+
if(options.help) {
45+
console.info(HELP_COMMANDS[command]);
46+
process.exit(0);
5647
}
48+
scripts[command](options).then(() => {
49+
console.info(`"${command}" command run successfully.`);
50+
process.exit(0);
51+
}).catch((error) => {
52+
console.error(error, `An error has occured while running command (${command}).`);
53+
process.exit(1);
54+
});
5755

5856
})();

0 commit comments

Comments
 (0)