Skip to content

Commit

Permalink
Fix calling docusaurus CLI with no command
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Aug 8, 2024
1 parent 427c3f2 commit c75078a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/docusaurus/bin/docusaurus.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ function isExternalCommand(command) {
return !!(command && !isInternalCommand(command) && !command.startsWith('-'));
}

// 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();
process.exit(1);
}

// There is an unrecognized subcommand
// Let plugins extend the CLI before parsing
if (isExternalCommand(process.argv[2])) {
Expand Down

0 comments on commit c75078a

Please sign in to comment.