Skip to content

Commit 608e380

Browse files
seraphiregitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e2aed5f commit 608e380

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

git-p4.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4145,7 +4145,12 @@ def main():
41454145
description = cmd.description,
41464146
formatter = HelpFormatter())
41474147

4148-
(cmd, args) = parser.parse_args(sys.argv[2:], cmd);
4148+
try:
4149+
(cmd, args) = parser.parse_args(sys.argv[2:], cmd);
4150+
except:
4151+
parser.print_help()
4152+
raise
4153+
41494154
global verbose
41504155
verbose = cmd.verbose
41514156
if cmd.needsGit:

0 commit comments

Comments
 (0)