info: Added --autoenable option

Use cases include using git-annex init --no-autoenable and then going back
and enabling the special remotes that have autoenable configured. As well
as just querying to remember which ones have it enabled.

It lists all special remotes that have autoenable=yes whether currently
enabled or not. And it can be used with --json.

I pondered making this "git-annex info autoenable", but that seemed wrong
because then if the use has a directory named "autoenable", it's unclear
what they are asking for. (Although "git-annex info remote" may be
similarly unclear.) Making it an option does mean that it can't be provided
via --batch though.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-06-01 14:20:38 -04:00
parent 0d50c90794
commit c59ea5b1ca
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 57 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{- git-annex trust log
-
- Copyright 2010-2020 Joey Hess <id@joeyh.name>
- Copyright 2010-2022 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -14,6 +14,7 @@ module Logs.Trust (
trustPartition,
trustExclude,
lookupTrust,
lookupTrust',
trustMapLoad,
) where
@ -37,7 +38,10 @@ trustGet level = M.keys . M.filter (== level) <$> trustMap
{- Returns the TrustLevel of a given repo UUID. -}
lookupTrust :: UUID -> Annex TrustLevel
lookupTrust u = (fromMaybe def . M.lookup u) <$> trustMap
lookupTrust u = lookupTrust' u <$> trustMap
lookupTrust' :: UUID -> TrustMap -> TrustLevel
lookupTrust' u m = fromMaybe def $ M.lookup u m
{- Partitions a list of UUIDs to those matching a TrustLevel and not. -}
trustPartition :: TrustLevel -> [UUID] -> Annex ([UUID], [UUID])