remove --backend from global options

--backend is no longer a global option, and is only accepted by commands
that actually need it.

Three commands that used to support backend but don't any longer are
watch, webapp, and assistant. It would be possible to make them support it,
but I doubt anyone used the option with these. And in the case of webapp
and assistant, the option was handled inconsistently, only taking affect
when the command is run with an existing git-annex repo, not when it
creates a new one.

Also, renamed GlobalOption etc to AnnexOption. Because there are many
options of this type that are not actually global (any more) and get
added to commands that need them.

Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
Joey Hess 2022-06-29 13:28:08 -04:00
parent 3eecf2033a
commit b223988e22
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
49 changed files with 209 additions and 196 deletions

View file

@ -11,8 +11,7 @@ module CmdLine.Option where
import Options.Applicative
import CmdLine.Usage
import CmdLine.GlobalSetter
import CmdLine.AnnexSetter
import qualified Annex
import Types.Messages
import Types.DeferredParse
@ -22,58 +21,50 @@ import Git.Config
import Utility.FileSystemEncoding
import Annex.Debug
-- Global options accepted by both git-annex and git-annex-shell sub-commands.
commonGlobalOptions :: [GlobalOption]
commonGlobalOptions =
[ globalFlag (setforce True)
-- Options accepted by both git-annex and git-annex-shell sub-commands.
commonOptions :: [AnnexOption]
commonOptions =
[ annexFlag (setforce True)
( long "force"
<> help "allow actions that may lose annexed data"
<> hidden
)
, globalFlag (setfast True)
, annexFlag (setfast True)
( long "fast" <> short 'F'
<> help "avoid slow operations"
<> hidden
)
, globalFlag (setAnnexState $ Annex.setOutput QuietOutput)
, annexFlag (setAnnexState $ Annex.setOutput QuietOutput)
( long "quiet" <> short 'q'
<> help "avoid verbose output"
<> hidden
)
, globalFlag (setAnnexState $ Annex.setOutput NormalOutput)
, annexFlag (setAnnexState $ Annex.setOutput NormalOutput)
( long "verbose" <> short 'v'
<> help "allow verbose output (default)"
<> hidden
)
, globalFlag (setdebug True)
, annexFlag (setdebug True)
( long "debug" <> short 'd'
<> help "show debug messages"
<> hidden
)
, globalFlag (setdebug False)
, annexFlag (setdebug False)
( long "no-debug"
<> help "don't show debug messages"
<> hidden
)
, globalOption setdebugfilter $ strOption
, annexOption setdebugfilter $ strOption
( long "debugfilter" <> metavar "NAME[,NAME..]"
<> help "show debug messages coming from a module"
<> hidden
)
, globalOption setforcebackend $ strOption
( long "backend" <> short 'b' <> metavar paramName
<> help "specify key-value backend to use"
<> hidden
)
]
where
setforce v = setAnnexRead $ \rd -> rd { Annex.force = v }
setfast v = setAnnexRead $ \rd -> rd { Annex.fast = v }
setforcebackend v = setAnnexRead $
\rd -> rd { Annex.forcebackend = Just v }
setdebug v = mconcat
[ setAnnexRead $ \rd -> rd { Annex.debugenabled = v }
-- Also set in git config so it will be passed on to any