[PATCH 12/13] scripts/ghes_inject: print help if no command specified

Mauro Carvalho Chehab posted 13 patches 2 weeks, 4 days ago
Maintainers: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>
There is a newer version of this series
[PATCH 12/13] scripts/ghes_inject: print help if no command specified
Posted by Mauro Carvalho Chehab 2 weeks, 4 days ago
The first positional argument (command) is mandatory. If not
specified, instead of a simple error message, show help as well.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/ghes_inject.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py
index 781b37cc68af..4028fdb15582 100755
--- a/scripts/ghes_inject.py
+++ b/scripts/ghes_inject.py
@@ -52,6 +52,9 @@ def main():
         if not args.func(args):
             sys.exit(1)
     else:
+        print("Error: no command specified\n", file=sys.stderr)
+        parser.print_help(file=sys.stderr)
+        print(file=sys.stderr)
         sys.exit(f"Please specify a valid command for {sys.argv[0]}")
 
 if __name__ == "__main__":
-- 
2.52.0
Re: [PATCH 12/13] scripts/ghes_inject: print help if no command specified
Posted by Jonathan Cameron via qemu development 2 weeks, 4 days ago
On Wed, 21 Jan 2026 12:25:20 +0100
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:

> The first positional argument (command) is mandatory. If not
> specified, instead of a simple error message, show help as well.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  scripts/ghes_inject.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py
> index 781b37cc68af..4028fdb15582 100755
> --- a/scripts/ghes_inject.py
> +++ b/scripts/ghes_inject.py
> @@ -52,6 +52,9 @@ def main():
>          if not args.func(args):
>              sys.exit(1)
>      else:
> +        print("Error: no command specified\n", file=sys.stderr)
> +        parser.print_help(file=sys.stderr)
> +        print(file=sys.stderr)
>          sys.exit(f"Please specify a valid command for {sys.argv[0]}")
>  
>  if __name__ == "__main__":