File: Main.hs

package info (click to toggle)
haskell-zip 2.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 196 kB
  • sloc: haskell: 2,452; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 494 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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