sak 0.1.0.1 → 0.1.0.2
raw patch · 5 files changed
+20/−6 lines, 5 filesdep ~lz4-hs
Dependency ranges changed: lz4-hs
Files
- CHANGELOG.md +4/−0
- man/sak.1 +1/−1
- sak.cabal +2/−2
- src/Compression.hs +12/−2
- src/Main.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # sak +## 0.1.0.2++ * Support higher compression levels for lz4+ ## 0.1.0.1 * Fix bug with default bz2 settings
man/sak.1 view
@@ -52,7 +52,7 @@ .IP \[bu] 2 zstd (0-22) .IP \[bu] 2-lz4 (n/a)+lz4 (0-12) .IP \[bu] 2 deflate (0-9) .SH SHELL COMPLETIONS
sak.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: sak-version: 0.1.0.1+version: 0.1.0.2 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2020 Vanessa McHale@@ -40,7 +40,7 @@ zlib -any, zstd -any, lzma -any,- lz4-hs >=0.1.3.0,+ lz4-hs >=0.1.4.0, optparse-applicative -any, filepath -any, bytestring -any
src/Compression.hs view
@@ -24,6 +24,7 @@ data CompressionLevel = Best | Fastest+ | Default | Custom !Int data Compression = Lzma@@ -107,22 +108,31 @@ toInt Zstd Best = Zstd.maxCLevel toInt Zstd Fastest = 1 toInt Zstd (Custom i) = levelGuard (1, Zstd.maxCLevel) i+toInt Zstd Default = 3 toInt Lzip Best = 9 toInt Lzip Fastest = 0 toInt Lzip (Custom i) = levelGuard (0, 9) i+toInt Lzip Default = 6 toInt Lzma Best = 9 toInt Lzma Fastest = 0 toInt Lzma (Custom i) = levelGuard (0, 9) i+toInt Lzma Default = 6 toInt BZip Best = 9 toInt BZip Fastest = 1-toInt BZip (Custom 6) = 7 toInt BZip (Custom i) = i+toInt BZip Default = 7 toInt GZip Best = 9 toInt GZip Fastest = 0 toInt GZip (Custom i) = i+toInt GZip Default = 6 toInt Z Best = 9 toInt Z Fastest = 0 toInt Z (Custom i) = i+toInt Z Default = 6+toInt Lz4 Best = Lz4.lZ4HCClevelMax+toInt Lz4 Fastest = 0+toInt Lz4 (Custom i) = levelGuard (0, Lz4.lZ4HCClevelMax) i+toInt Lz4 Default = 0 -- 1? toInt None _ = error "Internal error." toCompressor :: Compression -> CompressionLevel -> Maybe Int -> BSL.ByteString -> BSL.ByteString@@ -133,7 +143,7 @@ toCompressor GZip lvl _ = GZip.compressWith (gzipCompression $ toInt GZip lvl) toCompressor Z lvl _ = Zlib.compressWith (zlibCompression $ toInt Z lvl) toCompressor Zstd lvl _ = Zstd.compress (toInt Zstd lvl)-toCompressor Lz4 _ _ = Lz4.compress -- TODO: compression levels upstream+toCompressor Lz4 lvl _ = Lz4.compressSz (toInt Lz4 lvl) toCompressor None _ _ = id fileSize :: FilePath -> IO Integer
src/Main.hs view
@@ -52,6 +52,7 @@ compressCustom <|> compressBest <|> compressFast+ <|> flag Default Default mempty compressCustom :: Parser CompressionLevel compressCustom =@@ -59,7 +60,6 @@ option auto (long "compression-level" <> short 'l'- <> value 6 <> metavar "LVL" <> help "Compression level (usually 0-9)" <> completer (listCompleter (show <$> [(0::Int)..22]))