From 608e380502f754b50ead6c7e6c3f5ff5ee8eca33 Mon Sep 17 00:00:00 2001 From: Ben Keene Date: Mon, 16 Dec 2019 14:02:20 +0000 Subject: git-p4: show detailed help when parsing options fail When a user provides invalid parameters to git-p4, the program reports the failure but does not provide the correct command syntax. Add an exception handler to the command-line argument parser to display the command's specific command line parameter syntax when an exception is thrown. Rethrow the exception so the current behavior is retained. Signed-off-by: Ben Keene Signed-off-by: Junio C Hamano diff --git a/git-p4.py b/git-p4.py index 3b3f146..9165ada2 100755 --- a/git-p4.py +++ b/git-p4.py @@ -4145,7 +4145,12 @@ def main(): description = cmd.description, formatter = HelpFormatter()) - (cmd, args) = parser.parse_args(sys.argv[2:], cmd); + try: + (cmd, args) = parser.parse_args(sys.argv[2:], cmd); + except: + parser.print_help() + raise + global verbose verbose = cmd.verbose if cmd.needsGit: -- cgit v0.10.2-6-g49f6