Skip to content

Commit

Permalink
Merge pull request #173 from Icohedron/help_cmd
Browse files Browse the repository at this point in the history
Add help command for a link to documentation in the Run AQA workflow
  • Loading branch information
renfeiw authored Apr 7, 2021
2 parents 3f6e9a3 + fd031ea commit 0717152
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scripts/testBot/runAqaArgParse.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def main():

parser = argparse.ArgumentParser(prog=keyword, add_help=False)
# Improvement: Automatically resolve the valid choices for each argument populate them below, rather than hard-coding choices.
parser.add_argument('--help', '-h', action='store_true')
parser.add_argument('--sdk_resource', default=['nightly'], choices=['nightly', 'releases', 'customized'], nargs='+')
parser.add_argument('--customized_sdk_url', default=['None'], nargs='+')
parser.add_argument('--archive_extension', default=['.tar'], choices=['.zip', '.tar', '.7z'], nargs='+')
Expand All @@ -65,6 +66,22 @@ def main():
args = vars(parser.parse_args(raw_args))
# All args are lists of strings

# Help was requested. The simplest way to handle this is as if it were an error
# because stdout is reserved for workflow commands and logs.
if args['help']:
# For some unknown reason, the first tilde in this help message should not be escaped,
# otherwise a syntax error occurs when passed to the GitHub Script.
help_msg = '''Run AQA GitHub Action Documentation
`\\`\\`
https://github.com/AdoptOpenJDK/openjdk-tests/blob/master/doc/RunAqa.md
\\`\\`\\`
Click the above link to view the documentation for the Run AQA GitHub Workflow'''
sys.stderr.write(help_msg)
print('::error ::Help command invoked')
exit(2)
# Remove help flag from the args because it is not a parameter for the job matrix.
del args['help']

# Map grinder platform names to github runner names
args['platform'] = map_platforms(args['platform'])

Expand Down

0 comments on commit 0717152

Please sign in to comment.