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