2013-03-27 17:51:24 +00:00
|
|
|
{- common command-line options
|
2010-12-30 20:52:24 +00:00
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2010-2011 Joey Hess <id@joeyh.name>
|
2010-12-30 20:52:24 +00:00
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2010-12-30 20:52:24 +00:00
|
|
|
-}
|
|
|
|
|
2015-07-10 20:05:56 +00:00
|
|
|
module CmdLine.Option where
|
2010-12-30 20:52:24 +00:00
|
|
|
|
2015-07-10 04:55:53 +00:00
|
|
|
import Options.Applicative
|
2010-12-30 20:52:24 +00:00
|
|
|
|
2016-01-20 20:36:33 +00:00
|
|
|
import Annex.Common
|
2015-07-10 04:55:53 +00:00
|
|
|
import CmdLine.Usage
|
2015-07-10 06:18:08 +00:00
|
|
|
import CmdLine.GlobalSetter
|
2010-12-30 20:52:24 +00:00
|
|
|
import qualified Annex
|
2012-04-27 17:23:52 +00:00
|
|
|
import Types.Messages
|
2015-07-10 04:55:53 +00:00
|
|
|
import Types.DeferredParse
|
2010-12-30 20:52:24 +00:00
|
|
|
|
2015-07-10 04:55:53 +00:00
|
|
|
-- Global options accepted by both git-annex and git-annex-shell sub-commands.
|
2015-07-10 17:18:46 +00:00
|
|
|
commonGlobalOptions :: [GlobalOption]
|
2015-07-10 06:03:03 +00:00
|
|
|
commonGlobalOptions =
|
2015-07-10 04:55:53 +00:00
|
|
|
[ globalFlag (setforce True)
|
|
|
|
( long "force"
|
|
|
|
<> help "allow actions that may lose annexed data"
|
2015-07-10 06:18:08 +00:00
|
|
|
<> hidden
|
2015-07-10 04:55:53 +00:00
|
|
|
)
|
|
|
|
, globalFlag (setfast True)
|
|
|
|
( long "fast" <> short 'F'
|
|
|
|
<> help "avoid slow operations"
|
2015-07-10 06:18:08 +00:00
|
|
|
<> hidden
|
2015-07-10 04:55:53 +00:00
|
|
|
)
|
|
|
|
, globalFlag (Annex.setOutput QuietOutput)
|
|
|
|
( long "quiet" <> short 'q'
|
|
|
|
<> help "avoid verbose output"
|
2015-07-10 06:18:08 +00:00
|
|
|
<> hidden
|
2015-07-10 04:55:53 +00:00
|
|
|
)
|
|
|
|
, globalFlag (Annex.setOutput NormalOutput)
|
|
|
|
( long "verbose" <> short 'v'
|
|
|
|
<> help "allow verbose output (default)"
|
2015-07-10 06:18:08 +00:00
|
|
|
<> hidden
|
2015-07-10 04:55:53 +00:00
|
|
|
)
|
|
|
|
, globalFlag setdebug
|
|
|
|
( long "debug" <> short 'd'
|
|
|
|
<> help "show debug messages"
|
2015-07-10 06:18:08 +00:00
|
|
|
<> hidden
|
2015-07-10 04:55:53 +00:00
|
|
|
)
|
|
|
|
, globalFlag unsetdebug
|
|
|
|
( long "no-debug"
|
|
|
|
<> help "don't show debug messages"
|
2015-07-10 06:18:08 +00:00
|
|
|
<> hidden
|
2015-07-10 04:55:53 +00:00
|
|
|
)
|
|
|
|
, globalSetter setforcebackend $ strOption
|
|
|
|
( long "backend" <> short 'b' <> metavar paramName
|
|
|
|
<> help "specify key-value backend to use"
|
2015-07-10 06:18:08 +00:00
|
|
|
<> hidden
|
2015-07-10 04:55:53 +00:00
|
|
|
)
|
2010-12-31 17:39:30 +00:00
|
|
|
]
|
2012-10-29 01:27:15 +00:00
|
|
|
where
|
|
|
|
setforce v = Annex.changeState $ \s -> s { Annex.force = v }
|
|
|
|
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
|
|
|
|
setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
|
2013-06-18 00:41:17 +00:00
|
|
|
setdebug = Annex.changeGitConfig $ \c -> c { annexDebug = True }
|
|
|
|
unsetdebug = Annex.changeGitConfig $ \c -> c { annexDebug = False }
|