nvchecker/scripts/maintained_in_aur

23 lines
651 B
Python
Executable File

#!/usr/bin/env python3
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
'''show a list of packages maintained by someone in AUR'''
import sys
import json
import urllib.request
def main(user):
url = f'https://aur.archlinux.org/rpc.php?type=msearch&arg={user}'
res = urllib.request.urlopen(url)
if res.status != 200:
sys.exit(f'Error: {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?')