Skip to content

Commit

Permalink
Provide conditional exit status for USAGE
Browse files Browse the repository at this point in the history
Even though it's an older approach, it is trivial
to provide `USAGE` the same exit code logic as for
`GENERATE-USAGE`:

  If a `--help` is part of the invocation, exit 0.

  Otherwise, exit 2.

Addresses R#5514 (#5514).
  • Loading branch information
ab5tract committed Apr 28, 2024
1 parent 48ef5c3 commit a4c7d5d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core.c/Main.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ my sub RUN-MAIN(&main, $mainline, :$in-as-argsfiles) {
elsif !$provided-g-u && !$provided-a-to-c && %caller-my<&USAGE> -> &usage {
# DEPRECATED message here
usage;
exit $capture<help> ?? 0 !! 2;
}

# Display the default USAGE message on either STDOUT/STDERR
Expand Down

0 comments on commit a4c7d5d

Please sign in to comment.