mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-25 19:22:07 +00:00
Better diagnostics when abipkgdiff has an extra argument
When abipkgdiff is launched with three packages to compare rather than just two, it gives a nonsensical error, just like if a wrong option was given. This patch fixes that. * tools/abipkgdiff.cc (options::wrong_arg): New data member. (parse_command_line): Set options::wrong_arg to the wrong argument passed. (main): Tell wrong argument case apart, and report it. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
ef782b7536
commit
9086b015d1
@ -151,6 +151,7 @@ class options
|
||||
|
||||
public:
|
||||
string wrong_option;
|
||||
string wrong_arg;
|
||||
string prog_name;
|
||||
bool display_usage;
|
||||
bool display_version;
|
||||
@ -1806,8 +1807,11 @@ parse_command_line(int argc, char* argv[], options& opts)
|
||||
else if (opts.package2.empty())
|
||||
opts.package2 = abigail::tools_utils::make_path_absolute(argv[i]).get();
|
||||
else
|
||||
{
|
||||
opts.wrong_arg = argv[i];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[i], "--debug-info-pkg1")
|
||||
|| !strcmp(argv[i], "--d1"))
|
||||
{
|
||||
@ -1926,8 +1930,13 @@ main(int argc, char* argv[])
|
||||
vector<package_sptr> packages;
|
||||
if (!parse_command_line(argc, argv, opts))
|
||||
{
|
||||
if (!opts.wrong_option.empty())
|
||||
emit_prefix("abipkgdiff", cerr)
|
||||
<< "unrecognized option:" << opts.wrong_option
|
||||
<< "unrecognized option: " << opts.wrong_option
|
||||
<< "\ntry the --help option for more information\n";
|
||||
else
|
||||
emit_prefix("abipkgdiff", cerr)
|
||||
<< "unrecognized argument: " << opts.wrong_arg
|
||||
<< "\ntry the --help option for more information\n";
|
||||
return (abigail::tools_utils::ABIDIFF_USAGE_ERROR
|
||||
| abigail::tools_utils::ABIDIFF_ERROR);
|
||||
|
Loading…
Reference in New Issue
Block a user