Skip to content

Commit

Permalink
Report error on excess filenames (#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
aqnuep authored Jan 22, 2024
1 parent 4ac5403 commit c32d99a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tools/ktx/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ struct OptionsSingleIn {
}

void process(cxxopts::Options&, cxxopts::ParseResult& args, Reporter& report) {
if (!args.unmatched().empty())
report.fatal_usage("Too many filenames specified.");

if (args.count("stdin") + args.count("input-file") == 0)
report.fatal_usage("Missing input file. Either <input-file> or --stdin must be specified.");
if (args.count("stdin") + args.count("input-file") > 1)
Expand Down Expand Up @@ -273,6 +276,9 @@ struct OptionsSingleInSingleOut {
}

void process(cxxopts::Options&, cxxopts::ParseResult& args, Reporter& report) {
if (!args.unmatched().empty())
report.fatal_usage("Too many filenames specified.");

if (args.count("stdin") + args.count("input-file") == 0)
report.fatal_usage("Missing input file. Either <input-file> or --stdin must be specified.");
if (args.count("stdin") + args.count("input-file") > 1)
Expand Down

0 comments on commit c32d99a

Please sign in to comment.