Skip to content

Instantly share code, notes, and snippets.

@joswr1ght
Created August 2, 2023 11:24
Show Gist options
  • Save joswr1ght/c0fbf3d8086c46895a8dbbaa5db666ba to your computer and use it in GitHub Desktop.
Save joswr1ght/c0fbf3d8086c46895a8dbbaa5db666ba to your computer and use it in GitHub Desktop.
Search Ranges.io Package for Keyword, Display Matching Group and Short Title
#!/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