abilint: Add prompt message for abnormal operation
Commit Message
When using abilint, if the uses the --stdin option and also
provides 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>
---
tools/abilint.cc | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
Hello,
tangmeng <tangmeng@uniontech.com> a écrit:
> When using abilint, if the uses the --stdin option and also
> provides 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>
Applied to master, thanks!
Cheers,
@@ -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;
}