hstar 0.1.0.5 → 0.1.0.6
raw patch · 8 files changed
+40/−35 lines, 8 filesdep +lzma-staticdep −lzmadep ~lzlib
Dependencies added: lzma-static
Dependencies removed: lzma
Dependency ranges changed: lzlib
Files
- CHANGELOG.md +6/−0
- hstar.cabal +2/−2
- man/hstar.1 +20/−26
- src/Compression.cpphs +2/−0
- src/Compression/Type.cpphs +1/−0
- src/Main.hs +3/−2
- src/Tar.hs +5/−4
- src/Version.cpphs +1/−1
CHANGELOG.md view
@@ -1,3 +1,9 @@+# 0.1.0.6++ * Add `.shar` support+ * Detect `.zip` files properly+ * Depend on `lzma-static` over `lzma`+ # 0.1.0.5 * Allow compression level to be set on the command-line
hstar.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: hstar-version: 0.1.0.5+version: 0.1.0.6 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2019-2020 Vanessa McHale@@ -56,7 +56,7 @@ optparse-applicative -any, composition-prelude -any, bytestring -any,- lzma -any,+ lzma-static, bz2 >=1.0.0.0, zlib -any, zstd -any,
man/hstar.1 view
@@ -1,43 +1,38 @@-.\" Automatically generated by Pandoc 2.11+.\" Automatically generated by Pandoc 3.1.10 .\" .TH "hstar (1)" "" "" "" ""-.hy .SH NAME-.PP-hstar - An archiving tool+hstar \- An archiving tool .SH DESCRIPTION-.PP \f[B]hstar\f[R] is an archiving tool .SH SYNOPSIS-.PP hstar sanitize archive.tar.lz .PP-hstar unpack src-dist-0.1.0.0.tar.zst+hstar unpack src\-dist\-0.1.0.0.tar.zst .SH SUBCOMMANDS-.PP-\f[B]unpack\f[R] - Unpack an archive+\f[B]unpack\f[R] \- Unpack an archive .PP-\f[B]pack-dir\f[R] - Pack a directory into an tarball+\f[B]pack\-dir\f[R] \- Pack a directory into an tarball .PP-\f[B]pack\f[R] - Pack files into an archive+\f[B]pack\f[R] \- Pack files into an archive .PP-\f[B]pack-src\f[R] - Pack up a source directory, ignoring version+\f[B]pack\-src\f[R] \- Pack up a source directory, ignoring version control .PP-\f[B]sanitize\f[R] - Convert a tarball to a pax-compatible archive.+\f[B]sanitize\f[R] \- Convert a tarball to a pax\-compatible archive. This reads the whole file into memory. .PP-\f[B]repack\f[R] - Convert from one archive format to another.+\f[B]repack\f[R] \- Convert from one archive format to another. This reads the whole file into memory. .SH OPTIONS .TP-\f[B]-h\f[R] \f[B]--help\f[R]+\f[B]\-h\f[R] \f[B]\-\-help\f[R] Display help .TP-\f[B]-V\f[R] \f[B]--version\f[R]+\f[B]\-V\f[R] \f[B]\-\-version\f[R] Display version information .TP-\f[B]-l\f[R] \f[B]--compression-level\f[R]+\f[B]\-l\f[R] \f[B]\-\-compression\-level\f[R] Set compression level .SH SUPPORTED FORMATS .SS COMPRESSION@@ -62,7 +57,7 @@ .IP \[bu] 2 snappy (optional) .IP \[bu] 2-lrzip (decompression only; requires command-line executable at runtime)+lrzip (decompression only; requires command\-line executable at runtime) .SS Archive .IP \[bu] 2 tar@@ -73,21 +68,20 @@ .IP \[bu] 2 7zip .SH SHELL COMPLETIONS-.PP To get shell completions in your current session: .PP-\f[C]eval \[dq]$(hstar --bash-completion-script hstar)\[dq]\f[R]+\f[CR]eval \[dq]$(hstar \-\-bash\-completion\-script hstar)\[dq]\f[R] .PP-Put this in your \f[C]\[ti]/.bashrc\f[R] or-\f[C]\[ti]/.bash_profile\f[R] to install them.+Put this in your \f[CR]\[ti]/.bashrc\f[R] or+\f[CR]\[ti]/.bash_profile\f[R] to install them. .SH BUGS-.PP Please report any bugs you may come across to-http://github.com/vmchale/archive-backpack/issues.+http://github.com/vmchale/archive\-backpack/issues. .SH COPYRIGHT-.PP Copyright 2020. Vanessa McHale. All Rights Reserved. .SH AUTHORS-Vanessa McHale<vamchale@gmail.com>.+Vanessa McHale\c+.MT vamchale@gmail.com+.ME \c.
src/Compression.cpphs view
@@ -27,6 +27,7 @@ compressionByFileExt :: FilePath -> Archive compressionByFileExt fp | ".tgz" `isSuffixOf` fp = Tar GZip | ".cpio.gz" `isSuffixOf` fp = Cpio GZip+ | ".shar.Z" `isSuffixOf` fp = Shar Deflate | ".tar.bz2" `isSuffixOf` fp = Tar Bz2 | ".tar.bz" `isSuffixOf` fp = Tar Bz2 | ".tbz2" `isSuffixOf` fp = Tar Bz2@@ -53,6 +54,7 @@ #endif | ".tar" `isSuffixOf` fp = Tar None | ".7z" `isSuffixOf` fp = SevenZip+ | ".zip" `isSuffixOf` fp = Zip | otherwise = error "Suffix not supported or invalid." decompressor :: Compressor -> (BSL.ByteString -> BSL.ByteString)
src/Compression/Type.cpphs view
@@ -5,6 +5,7 @@ data Archive = Tar !Compressor | SevenZip | Cpio !Compressor+ | Shar !Compressor | Zip data Compressor = Lzma
src/Main.hs view
@@ -1,7 +1,7 @@ module Main ( main ) where -import Codec.Archive (Entry (Entry), EntryContent (Hardlink), entriesToBSL, entriesToBSL7zip, entriesToBSLCpio, entriesToBSLzip,- readArchiveBSL)+import Codec.Archive (Entry (Entry), EntryContent (Hardlink), entriesToBSL, entriesToBSL7zip, entriesToBSLCpio, entriesToBSLShar,+ entriesToBSLzip, readArchiveBSL) import Compression import Compression.Level import Compression.Type@@ -53,6 +53,7 @@ Cpio{} -> entriesToBSLCpio es SevenZip -> entriesToBSL7zip es Zip -> entriesToBSLzip es+ Shar{} -> entriesToBSLShar es BSL.writeFile out (compressor (fromArchive outArchive) lvl archiveContentsNew) selfLink :: Eq fp => Entry fp e -> Bool
src/Tar.hs view
@@ -5,7 +5,7 @@ , packSrcDirAndCompress ) where -import Codec.Archive (packFiles, packFiles7zip, packFilesCpio, packFilesZip, throwArchiveM, unpackToDirLazy)+import Codec.Archive (packFiles, packFiles7zip, packFilesCpio, packFilesShar, packFilesZip, throwArchiveM, unpackToDirLazy) import Compression.Level (CompressionLevel, compressor) import Compression.Type (Archive (..)) import Control.Composition ((.*))@@ -26,16 +26,17 @@ packFromDirAndCompress a lvl dir tar = packFromFilesAndCompress a lvl tar =<< getDirRecursive dir packFromFilesAndCompress :: Archive -> CompressionLevel -> FilePath -> [FilePath] -> IO ()-packFromFilesAndCompress (Tar c) lvl tar fps = BSL.writeFile tar =<< (compressor c lvl <$> packFiles fps)+packFromFilesAndCompress (Tar c) lvl tar fps = BSL.writeFile tar . compressor c lvl =<< packFiles fps packFromFilesAndCompress SevenZip _ tar fps = BSL.writeFile tar =<< packFiles7zip fps-packFromFilesAndCompress (Cpio c) lvl tar fps = BSL.writeFile tar =<< (compressor c lvl <$> packFilesCpio fps)+packFromFilesAndCompress (Cpio c) lvl tar fps = BSL.writeFile tar . compressor c lvl =<< packFilesCpio fps+packFromFilesAndCompress (Shar c) lvl tar fps = BSL.writeFile tar . compressor c lvl =<< packFilesShar fps packFromFilesAndCompress Zip _ tar fps = BSL.writeFile tar =<< packFilesZip fps unpackFileToDirAndDecompress :: Decompressor -- ^ Decompression to use -> FilePath -- ^ Filepath pointing to archive -> FilePath -- ^ Directory -> IO ()-unpackFileToDirAndDecompress f tar dir = unpackToDir dir =<< (f <$> BSL.readFile tar)+unpackFileToDirAndDecompress f tar dir = unpackToDir dir . f =<< BSL.readFile tar packSrcDirAndCompress :: Archive -> CompressionLevel -> FilePath -> FilePath -> IO () packSrcDirAndCompress a lvl dir tar = packFromFilesAndCompress a lvl tar =<< getDirFiltered (pure.srcFilter) dir
src/Version.cpphs view
@@ -19,7 +19,7 @@ ++ "lzlib API: " ++ show (lZApiVersion :: Int) ++ "\n" ++ "zlib-hs: " ++ VERSION_zlib ++ "\n" ++ "zlib: " ++ zlib ++ "\n"- ++ "lzma-hs: " ++ VERSION_lzma ++ "\n"+ ++ "lzma-static-hs: " ++ VERSION_lzma_static ++ "\n" ++ "lzma: " ++ lzma ++ "\n" ++ "lz4-hs: " ++ VERSION_lz4_hs ++ "\n" ++ "lz4: " ++ lZ4VersionString ++ "\n"