Skip to content

Commit

Permalink
Don't print missing positional argument error with --help
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-goode authored and jrohel committed Oct 18, 2023
1 parent cfff187 commit c292df7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dnf5/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,11 @@ int main(int argc, char * argv[]) try {
if (strcmp(argv[idx], "-h") == 0 || strcmp(argv[idx], "--help") == 0) {
arg_parser.get_selected_command()->help();
help_printed = true;
// Ignore the error and exit 0 if it's just a missing
// positional argument, e.g. `dnf5 install --help`
if (dynamic_cast<libdnf5::cli::ArgumentParserMissingPositionalArgumentError *>(&ex)) {
return static_cast<int>(libdnf5::cli::ExitCode::SUCCESS);
}
break;
}
}
Expand Down

0 comments on commit c292df7

Please sign in to comment.