Skip to content

Commit

Permalink
chore: amend code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vvagaytsev committed Oct 16, 2023
1 parent 57db35a commit e474f89
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand All @@ -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())
}

Expand Down

0 comments on commit e474f89

Please sign in to comment.