From 40d4eb959575a626483425bc65f55800c860da70 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 22 Sep 2021 20:22:07 -0700 Subject: [PATCH] Let fdroidapk take '*' to update all packages in cwd. --- fdroidapk.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fdroidapk.py b/fdroidapk.py index 457d008..8bf7afc 100644 --- a/fdroidapk.py +++ b/fdroidapk.py @@ -73,6 +73,17 @@ def _retry_request(f, tries=5): time.sleep(bo.next()) tries -= 1 +def ls_packages(path): + packages = set() + items = path.listdir() + for item in items: + if item.is_dir and '.' in item.basename: + packages.add(item.basename) + elif item.is_file and item.extension == 'apk': + package = item.basename.split('-')[0] + packages.add(package) + return sorted(packages) + @pipeable.ctrlc_return1 def fpk_argparse(args): destination = pathclass.Path(args.destination) @@ -80,7 +91,11 @@ def fpk_argparse(args): return_status = 0 - for package in args.packages: + packages = args.packages + if packages == ['*']: + packages = ls_packages(pathclass.cwd()) + + for package in packages: package = normalize_package_name(package) try: