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:
parent
f2aaa0e985
commit
3b8e6dd816
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue