mirror of
https://github.com/simplex-chat/zip.git
synced 2026-06-03 09:17:33 +00:00
20 lines
494 B
Haskell
20 lines
494 B
Haskell
module Main (main) where
|
|
|
|
import Codec.Archive.Zip
|
|
import System.Environment (getArgs)
|
|
import System.Exit (exitFailure)
|
|
import System.FilePath
|
|
|
|
main :: IO ()
|
|
main = do
|
|
[operation, input, output] <- getArgs
|
|
case operation of
|
|
"compress" -> do
|
|
selector <- mkEntrySelector (takeFileName input)
|
|
createArchive output (loadEntry Deflate selector input)
|
|
"uncompress" ->
|
|
withArchive input (unpackInto output)
|
|
_ -> do
|
|
putStrLn "Unknown command."
|
|
exitFailure
|