Skip to content

Commit

Permalink
Added version output with -v
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Torrey <[email protected]>
  • Loading branch information
ranok committed Feb 21, 2024
1 parent 225b380 commit 8ab9d4d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zippy/zippy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import List, Optional, Tuple, TypeAlias
from multiprocessing import Pool, cpu_count
from importlib.resources import files
from .__init__ import __version__

Score : TypeAlias = tuple[str, float]

Expand Down Expand Up @@ -339,13 +340,17 @@ def run_on_text_chunked(self, s : str, chunk_size : int = 1500, prelude_file : O

def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", required=False, action='store_true', help="Display the version and exit")
parser.add_argument("-p", required=False, help="Preset to use with compressor, higher values are slower but provide better compression")
parser.add_argument("-e", choices=['zlib', 'lzma', 'brotli', 'ensemble'], help='Which compression engine to use: lzma, zlib, brotli, or an ensemble of all engines', default='lzma', required=False)
group = parser.add_mutually_exclusive_group()
group.add_argument("-s", help='Read from stdin until EOF is reached instead of from a file', required=False, action='store_true')
group.add_argument("sample_files", nargs='*', help='Text file(s) containing the sample to classify', default="")
args = parser.parse_args()
engine = 'lzma'
if args.v:
print(__version__)
return
if args.e:
if args.e == 'lzma':
engine = CompressionEngine.LZMA
Expand Down

0 comments on commit 8ab9d4d

Please sign in to comment.