diff --git a/core/src/cli/cli.ts b/core/src/cli/cli.ts index 02b7fde3de..c0ce68e042 100644 --- a/core/src/cli/cli.ts +++ b/core/src/cli/cli.ts @@ -492,19 +492,19 @@ ${renderCommands(commands)} } // Parse the arguments again with the Command set, to fully validate, and to ensure boolean options are - // handled correctly + // handled correctly. argv = parseCliArgs({ stringArgs: args, command, cli: true }) // Slice command name from the positional args argv._ = argv._.slice(command.getPath().length) - // Handle -h and --help flags, those are always valid and should return exit code 0. + // Handle -h and --help flags, those are always valid and should return exit code 0 if (hasHelpFlag(argv)) { // Handle subcommand listings if (command instanceof CommandGroup) { const subCommandName = rest[0] if (subCommandName === undefined) { - // exit code 0 if sub-command is not specified and --help flag is passed, e.g. garden get --help + // Exit code 0 if sub-command is not specified and --help flag is passed, e.g. garden get --help return done(0, command.renderHelp()) } @@ -525,11 +525,11 @@ ${renderCommands(commands)} } // Handle incomplete subcommand listings. - // A complete sub-command won't be recognized as CommandGroup + // A complete sub-command won't be recognized as CommandGroup. if (command instanceof CommandGroup) { const subCommandName = rest[0] if (subCommandName === undefined) { - // exit code 0 if sub-command is not specific and --help flag is passed, e.g. garden get --help + // exit code 1 if sub-command is missing return done(1, command.renderHelp()) }