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,7 +11,7 @@ import Annex.Common
import qualified Git.Construct
import qualified Git.Config
import CmdLine
import CmdLine.GlobalSetter
import CmdLine.AnnexSetter
import Command
import Annex.UUID
import CmdLine.GitAnnexShell.Checks
@ -37,7 +37,7 @@ cmdsMap = M.fromList $ map mk
, (ServeReadWrite, allcmds)
]
where
readonlycmds = map addGlobalOptions
readonlycmds = map addAnnexOptions
[ Command.ConfigList.cmd
, gitAnnexShellCheck Command.NotifyChanges.cmd
-- p2pstdio checks the enviroment variables to
@ -46,10 +46,10 @@ cmdsMap = M.fromList $ map mk
, gitAnnexShellCheck Command.InAnnex.cmd
, gitAnnexShellCheck Command.SendKey.cmd
]
appendcmds = readonlycmds ++ map addGlobalOptions
appendcmds = readonlycmds ++ map addAnnexOptions
[ gitAnnexShellCheck Command.RecvKey.cmd
]
allcmds = appendcmds ++ map addGlobalOptions
allcmds = appendcmds ++ map addAnnexOptions
[ gitAnnexShellCheck Command.DropKey.cmd
, Command.GCryptSetup.cmd
]
@ -63,16 +63,16 @@ cmdsFor = fromMaybe [] . flip M.lookup cmdsMap
cmdsList :: [Command]
cmdsList = nub $ concat $ M.elems cmdsMap
addGlobalOptions :: Command -> Command
addGlobalOptions c = c { cmdglobaloptions = globalOptions ++ cmdglobaloptions c }
addAnnexOptions :: Command -> Command
addAnnexOptions c = c { cmdannexoptions = commonShellOptions ++ cmdannexoptions c }
globalOptions :: [GlobalOption]
globalOptions =
globalOption (setAnnexState . checkUUID) (strOption
commonShellOptions :: [AnnexOption]
commonShellOptions =
annexOption (setAnnexState . checkUUID) (strOption
( long "uuid" <> metavar paramUUID
<> help "local repository uuid"
))
: commonGlobalOptions
: commonOptions
where
checkUUID expected = getUUID >>= check
where