Error out for unrecognized option, more than one file

Change-Id: I7b7797a04ce824f263c4db6e64eefee083cc4c9d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/24340
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto 2020-07-06 13:15:26 +00:00 committed by dan sinclair
parent f2aaa0e985
commit 3b8e6dd816
1 changed files with 10 additions and 0 deletions

View File

@ -162,6 +162,16 @@ bool ParseArgs(const std::vector<std::string>& args, Options* opts) {
} else if (arg == "--dump-ast") {
opts->dump_ast = true;
} else if (!arg.empty()) {
if (arg[0] == '-') {
std::cerr << "Unrecognized option: " << arg << std::endl;
return false;
}
if (!opts->input_filename.empty()) {
std::cerr << "More than one input file specified: '"
<< opts->input_filename << "' and '" << arg << "'"
<< std::endl;
return false;
}
opts->input_filename = arg;
}
}