From 50dbdba993d0a0e1780e83a0ffe77607eec4b13d Mon Sep 17 00:00:00 2001 From: anjakefala Date: Sat, 6 Jul 2024 23:05:38 -0700 Subject: [PATCH] [dev] bump version to v0.6 --- README.md | 2 +- setup.py | 2 +- unzip_http.py | 20 +++++++++----------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9ea716d..a94f316 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Extract individual files from .zip files over http without downloading the entir ## Usage - unzip-http [-l] [-f] [-o] + unzip_http [-l] [-f] [-o] Extract from a remote .zip at `` to stdout. diff --git a/setup.py b/setup.py index 391aa49..f0456e9 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def requirements(): setup( name="unzip-http", - version="0.5.1", + version="0.6", description="extract files from .zip files over http without downloading entire archive", long_description=readme(), long_description_content_type="text/markdown", diff --git a/unzip_http.py b/unzip_http.py index 582378a..6ff1852 100755 --- a/unzip_http.py +++ b/unzip_http.py @@ -21,7 +21,7 @@ # SOFTWARE. """ -usage: unzip-http [-h] [-l] [-f] [-o] url [files ...] +usage: unzip_http [-h] [-l] [-f] [-o] url [files ...] Extract individual files from .zip files over http without downloading the entire archive. HTTP server must send `Accept-Ranges: bytes` and @@ -56,7 +56,7 @@ import urllib.parse -__version__ = '0.5.1' +__version__ = '0.6' def error(s): @@ -356,14 +356,6 @@ def download_file(f, rzf, args): extract_one(of, rzf, f, str(path)) -def run(args): - rzf = RemoteZipFile(args.url[0]) - if args.list or len(args.files) == 0: - list_files(rzf) - else: - for f in rzf.infolist(): - download_file(f, rzf, args) - def main(): parser = argparse.ArgumentParser(prog='unzip-http', \ description="Extract individual files from .zip files over http without downloading the entire archive. HTTP server must send `Accept-Ranges: bytes` and `Content-Length` in headers.") @@ -379,7 +371,13 @@ def main(): parser.add_argument("files", nargs='*', help="Files to extract. If no filenames given, displays .zip contents (filenames and sizes). Each filename can be a wildcard glob.") args = parser.parse_args() - run(args) + + rzf = RemoteZipFile(args.url[0]) + if args.list or len(args.files) == 0: + list_files(rzf) + else: + for f in rzf.infolist(): + download_file(f, rzf, args)