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 ())
|
|
|
|
|
|
|
|
storeOptBool :: FlagName -> Bool -> Annex ()
|
|
|
|
storeOptBool name val = Annex.flagChange name $ FlagBool val
|
|
|
|
storeOptString :: FlagName -> String -> Annex ()
|
|
|
|
storeOptString name val = Annex.flagChange name $ FlagString val
|
|
|
|
|
|
|
|
commonOptions :: [Option]
|
2010-12-31 17:39:30 +00:00
|
|
|
commonOptions =
|
|
|
|
[ Option ['f'] ["force"] (NoArg (storeOptBool "force" True))
|
2010-12-30 20:52:24 +00:00
|
|
|
"allow actions that may lose annexed data"
|
2010-12-31 17:39:30 +00:00
|
|
|
, Option ['q'] ["quiet"] (NoArg (storeOptBool "quiet" True))
|
2010-12-30 20:52:24 +00:00
|
|
|
"avoid verbose output"
|
2010-12-31 17:39:30 +00:00
|
|
|
, Option ['v'] ["verbose"] (NoArg (storeOptBool "quiet" False))
|
2010-12-30 20:52:24 +00:00
|
|
|
"allow verbose output"
|
2010-12-31 17:39:30 +00:00
|
|
|
, Option ['b'] ["backend"] (ReqArg (storeOptString "backend") paramName)
|
2010-12-30 20:52:24 +00:00
|
|
|
"specify default key-value backend to use"
|
2010-12-31 17:39:30 +00:00
|
|
|
]
|