init: Added --no-autoenable option

Someone may disagree with what repositories are set to autoenable and
it's good to have local overrides.

See https://github.com/datalad/datalad/issues/6634

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-06-01 13:27:49 -04:00
parent cac752d720
commit 0d50c90794
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 18 additions and 2 deletions

View file

@ -25,6 +25,7 @@ data InitOptions = InitOptions
{ initDesc :: String
, initVersion :: Maybe RepoVersion
, autoEnableOnly :: Bool
, noAutoEnable :: Bool
}
optParser :: CmdParamsDesc -> Parser InitOptions
@ -38,6 +39,10 @@ optParser desc = InitOptions
( long "autoenable"
<> help "only enable special remotes configured with autoenable=true"
)
<*> switch
( long "no-autoenable"
<> help "do not enable special remotes configured with autoenable=true"
)
parseRepoVersion :: MonadFail m => String -> m RepoVersion
parseRepoVersion s = case RepoVersion <$> readish s of
@ -73,7 +78,8 @@ perform os = do
initialize False
(if null (initDesc os) then Nothing else Just (initDesc os))
(initVersion os)
Annex.SpecialRemote.autoEnable
unless (noAutoEnable os)
Annex.SpecialRemote.autoEnable
next $ return True
performAutoEnableOnly :: CommandPerform