nvchecker/scripts/maintained_in_aur

21 lines
578 B
Plaintext
Raw Normal View History

#!/usr/bin/env python3
'''show a list of packages maintained by someone in AUR'''
import sys
import json
import urllib.request
def main(user):
url = 'https://aur.archlinux.org/rpc.php?type=msearch&arg=' + user
res = urllib.request.urlopen(url)
if res.status != 200:
sys.exit('Error: %d %s' % (res.status, res.reason))
d = res.read().decode('utf-8')
d = json.loads(d)
print('\n'.join(sorted(pkg['Name'] for pkg in d['results'])))
if __name__ == '__main__':
main(sys.argv[1]) if len(sys.argv) == 2 else \
sys.exit('whose packages do you want to see?')