We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a273f0e commit 68d4ad0Copy full SHA for 68d4ad0
bin/cmd.js
@@ -58,4 +58,21 @@ program
58
});
59
60
61
+// error on unknown commands
62
+// ref: https://github.com/tj/commander.js#custom-event-listeners
63
+program
64
+ .on('command:*', function () {
65
+ console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
66
+ process.exit(1);
67
+ });
68
+
69
program.parse(process.argv);
70
71
+// check if no command line args are provided
72
+// ref: https://github.com/tj/commander.js/issues/7#issuecomment-32448653
73
+var NO_COMMAND_SPECIFIED = program.args.length === 0;
74
75
+if (NO_COMMAND_SPECIFIED) {
76
+ // user did not supply args, so show --help
77
+ program.help();
78
+}
0 commit comments