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

@ -38,20 +38,20 @@ instance DeferredParseClass (Maybe (DeferredParse a)) where
instance DeferredParseClass [DeferredParse a] where
finishParse v = mapM finishParse v
type GlobalOption = Parser GlobalSetter
type AnnexOption = Parser AnnexSetter
-- Used for global options that can modify Annex state by running
-- Used for options that can modify Annex state by running
-- an arbitrary action in it, and can also set up AnnexRead.
data GlobalSetter = GlobalSetter
data AnnexSetter = AnnexSetter
{ annexStateSetter :: Annex ()
, annexReadSetter :: AnnexRead -> AnnexRead
}
instance Sem.Semigroup GlobalSetter where
a <> b = GlobalSetter
instance Sem.Semigroup AnnexSetter where
a <> b = AnnexSetter
{ annexStateSetter = annexStateSetter a >> annexStateSetter b
, annexReadSetter = annexReadSetter b . annexReadSetter a
}
instance Monoid GlobalSetter where
mempty = GlobalSetter (return ()) id
instance Monoid AnnexSetter where
mempty = AnnexSetter (return ()) id