summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorBen Keene <seraphire@gmail.com>2019-12-16 14:02:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-16 20:32:13 (GMT)
commit608e380502f754b50ead6c7e6c3f5ff5ee8eca33 (patch)
tree766efdaac3ea7e8a0c4292a3d53c04c9c2606727 /git-p4.py
parente2aed5fd5bfb0381a6f69373c01ef09d70467a5c (diff)
downloadgit-608e380502f754b50ead6c7e6c3f5ff5ee8eca33.zip
git-608e380502f754b50ead6c7e6c3f5ff5ee8eca33.tar.gz
git-608e380502f754b50ead6c7e6c3f5ff5ee8eca33.tar.bz2
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 <seraphire@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-p4.py b/git-p4.py
index 3b3f146..9165ada 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: