Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix printing help on Python 3.10 #738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ccmlib/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,15 @@ def usage(self):
:return Usage for the remote execution options
"""
# Retrieve the text for just the arguments
usage = self.parser.format_help().split("optional arguments:")[1]
formatted = self.parser.format_help()
try:
usage = formatted.split("optional arguments:")[1]
except IndexError:
try:
usage = formatted.split("options:")[1]
except IndexError:
# fallback to print the whole string
usage = formatted

# Remove any blank lines and return
return "Remote Options:" + os.linesep + \
Expand Down