abilint: Add prompt message for abnormal operation

When using abilint, if the user provides the --stdin option as well as
a file path on the command line, the file path is silently ignored.

This patch provides a warning to notify the user that the file path is
ignored in that case.

	* tools/abilint.cc (parse_command_line): Notify the user when the
	path to the file is ignored because the --stdin option was
	provided.

Signed-off-by: tangmeng <tangmeng@uniontech.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
tangmeng 2021-11-05 17:17:18 +08:00 committed by Dodji Seketeli
parent d71d76db21
commit c36f8028fd

View File

@ -205,6 +205,14 @@ parse_command_line(int argc, char* argv[], options& opts)
if (opts.file_path.empty())
opts.read_from_stdin = true;
if (opts.read_from_stdin && !opts.file_path.empty())
{
emit_prefix(argv[0], cout)
<< "WARNING: The \'--stdin\' option is used. The "
<< opts.file_path << " will be ignored automatically\n";
}
return true;
}