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

Dylan Baker dylan at pnwbakers.com
Thu Aug 25 18:34:57 UTC 2016


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())
     subparsers = parser.add_subparsers()
     print_cmd = subparsers.add_parser('print-cmd',
                                       add_help=False,
-- 
2.9.3



More information about the Piglit mailing list