packages feed

hsbackup-0.1.1: Config.hs

{-# LANGUAGE DeriveDataTypeable #-}

module Config where

import System.Console.CmdArgs

data Config = Take { from :: FilePath, repo :: FilePath }
            | List { repo :: FilePath, root :: String }
            | Restore { repo :: FilePath, to :: FilePath, root :: String }
              deriving (Show, Data, Typeable)

conf :: [Mode Config]
conf =
 [ mode $ Take { repo = ""      &= argPos 1 & typ "REPONAME"
               , from = ""      &= argPos 0 & typ "DIRECTORY" }
 , mode $ List { repo = ""      &= argPos 0 & typ "REPONAME"
               , root = ""      &= flag "r" & typ "HASH" }
 , mode $ Restore { repo = "."  &= argPos 0 & typ "REPONAME"
                  , to = ""     &= argPos 1 & typ "DIRECTORY"
                  , root = ""   &= flag "r" & typ "HASH" }
 ]