Created
August 2, 2023 11:24
-
-
Save joswr1ght/c0fbf3d8086c46895a8dbbaa5db666ba to your computer and use it in GitHub Desktop.
Search Ranges.io Package for Keyword, Display Matching Group and Short Title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import sys | |
if (len(sys.argv) != 3): | |
sys.stderr.write('Search RIO Package for string, identify matching group' | |
' and short title\n') | |
sys.stderr.write(f'Usage: {sys.argv[0]} package_export.json "keyword"\n') | |
sys.exit(0) | |
with open(sys.argv[1]) as pf: | |
packagejson = pf.read() | |
p = json.loads(packagejson) | |
for group in p['groups']: | |
groupname = group['name'] | |
for challenge in group['challenges']: | |
challengename = challenge['shortTitle'] | |
if (sys.argv[2] in json.dumps(challenge)): | |
print(f'{groupname}: {challengename}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment