[Piglit] [PATCH] piglit: Print help instead of excepting if no arguments are given

Jordan Justen jordan.l.justen at intel.com
Fri Aug 26 00:18:17 UTC 2016


On 2016-08-25 11:34:57, Dylan Baker wrote:
> This fixes a small bug that causes piglit to print an exception when
> ./piglit is called with no arguments. It will, with this patch, print
> the help message and exit.
> 
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  piglit | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/piglit b/piglit
> index 05fff14..14094a7 100755
> --- a/piglit
> +++ b/piglit
> @@ -121,6 +121,9 @@ def main():
>          input_ = sys.argv[1:]
>  
>      parser = argparse.ArgumentParser()
> +    # This ugly little line just causes piglit to print the help message if
> +    # ./piglit is run without any positional arguments
> +    parser.set_defaults(func=lambda *_, **__: parser.print_help())

Not sure about the comment (I'd be fine to drop it), but:

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

>      subparsers = parser.add_subparsers()
>      print_cmd = subparsers.add_parser('print-cmd',
>                                        add_help=False,
> -- 
> 2.9.3
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list