diff mbox series

abilint: Add prompt message for abnormal operation

Message ID 20211105091718.13221-1-tangmeng@uniontech.com
State New
Headers show
Series abilint: Add prompt message for abnormal operation | expand

Commit Message

tangmeng Nov. 5, 2021, 9:17 a.m. UTC
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

Dodji Seketeli Nov. 9, 2021, 10 a.m. UTC | #1
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,
diff mbox series

Patch

diff --git a/tools/abilint.cc b/tools/abilint.cc
index 88cf4589..ebf14a71 100644
--- a/tools/abilint.cc
+++ b/tools/abilint.cc
@@ -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;
 }