Skip to content

Commit

Permalink
add exit(1) for bad command names
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Aug 8, 2024
1 parent c75078a commit 556df66
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/docusaurus/bin/docusaurus.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ cli

cli.arguments('<command>').action((cmd) => {
cli.outputHelp();
logger.error` Unknown command name=${cmd}.`;
logger.error`Unknown Docusaurus CLI command name=${cmd}.`;
process.exit(1);
});

// === The above is the commander configuration ===
Expand Down Expand Up @@ -257,8 +258,8 @@ function isExternalCommand(command) {
// No command? We print the help message because Commander doesn't
// Note argv looks like this: ['../node','../docusaurus.mjs','<command>',...rest]
if (process.argv.length < 3) {
logger.error("You haven't provided any Docusaurus CLI command.");
cli.outputHelp();
logger.error`Please provide a Docusaurus CLI command.`;
process.exit(1);
}

Expand Down

0 comments on commit 556df66

Please sign in to comment.