2010-12-30 20:52:24 +00:00
|
|
|
{- git-annex dashed options
|
|
|
|
-
|
|
|
|
- Copyright 2010 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Options where
|
|
|
|
|
|
|
|
import System.Console.GetOpt
|
|
|
|
|
|
|
|
import qualified Annex
|
|
|
|
import Types
|
|
|
|
import Command
|
|
|
|
|
|
|
|
{- Each dashed command-line option results in generation of an action
|
|
|
|
- in the Annex monad that performs the necessary setting.
|
|
|
|
-}
|
|
|
|
type Option = OptDescr (Annex ())
|
|
|
|
|
|
|
|
commonOptions :: [Option]
|
2010-12-31 17:39:30 +00:00
|
|
|
commonOptions =
|
2011-01-26 04:17:38 +00:00
|
|
|
[ Option ['f'] ["force"] (NoArg (setforce True))
|
2010-12-30 20:52:24 +00:00
|
|
|
"allow actions that may lose annexed data"
|
2011-03-22 21:41:06 +00:00
|
|
|
, Option ['F'] ["fast"] (NoArg (setfast True))
|
|
|
|
"avoid slow operations"
|
2011-01-26 04:17:38 +00:00
|
|
|
, Option ['q'] ["quiet"] (NoArg (setquiet True))
|
2010-12-30 20:52:24 +00:00
|
|
|
"avoid verbose output"
|
2011-01-26 04:17:38 +00:00
|
|
|
, Option ['v'] ["verbose"] (NoArg (setquiet False))
|
2010-12-30 20:52:24 +00:00
|
|
|
"allow verbose output"
|
2011-01-26 04:17:38 +00:00
|
|
|
, Option ['b'] ["backend"] (ReqArg setdefaultbackend paramName)
|
2010-12-30 20:52:24 +00:00
|
|
|
"specify default key-value backend to use"
|
2010-12-31 17:39:30 +00:00
|
|
|
]
|
2011-01-26 04:17:38 +00:00
|
|
|
where
|
|
|
|
setforce v = Annex.changeState $ \s -> s { Annex.force = v }
|
2011-03-22 21:41:06 +00:00
|
|
|
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
|
2011-01-26 04:17:38 +00:00
|
|
|
setquiet v = Annex.changeState $ \s -> s { Annex.quiet = v }
|
|
|
|
setdefaultbackend v = Annex.changeState $ \s -> s { Annex.defaultbackend = Just v }
|