diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-09-13 13:50:33 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2023-09-13 13:50:33 -0400 |
commit | ee7de4593594013ca117bd9b72da44ab1e731c73 (patch) | |
tree | e1300b6d9dff6f0483c7750cac0ce27715985d70 /firewatch/firewatch.py | |
parent | 3a5f5e528d13d30e0b240edb19859c4cf570e9b3 (diff) | |
download | firewatch-ee7de4593594013ca117bd9b72da44ab1e731c73.tar.gz |
Add ability to display .conda packages
* Allow user to filter package list with positional arguments
Diffstat (limited to 'firewatch/firewatch.py')
-rw-r--r-- | firewatch/firewatch.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/firewatch/firewatch.py b/firewatch/firewatch.py index 9d0ca7b..8da1f95 100644 --- a/firewatch/firewatch.py +++ b/firewatch/firewatch.py @@ -75,9 +75,12 @@ def get_packages(channels): ) try: + print(f"Retrieving {channel}", file=sys.stderr) with requests.get(repodata) as r: r.raise_for_status() - data['packages'] = json.loads(r.text)['packages'] + remote = json.loads(r.text) + data['packages'] = remote['packages'] + data['packages'].update(remote['packages.conda']) packages.append(data) except requests.exceptions.RequestException as e: @@ -180,6 +183,9 @@ def main(): from argparse import ArgumentParser parser = ArgumentParser() + parser.add_argument('package', default=[], nargs='*', + help='Return package starting with pattern PACKAGE') + parser.add_argument('--benchmark', action='store_true', help='Display total time to parse and sort channel data') @@ -260,6 +266,16 @@ def main(): chn = info['channel'] tstr = ts.isoformat() + + has_package = False + if args.package: + for p in args.package: + if name.startswith(p): + has_package = True + + if not has_package: + continue + if span_delta < ts: try: print(f'{tstr:<20s}: {chn:<{channel_width}s}: {name:<40s}') |