--anything and --nothing

Added --anything (and --nothing). Eg, git-annex find --anything will list
all annexed files whether or not the content is present. This is slightly
faster and clearer than --include=* or --exclude=*

While I can't imagine how --nothing will be used, preferred content
expressions already had anything and nothing, so might as well support both
as matching options as well.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-12-20 15:42:34 -04:00
parent 9d60385001
commit 0b2dd374d8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 60 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{- user-specified limits on files to act on
-
- Copyright 2011-2021 Joey Hess <id@joeyh.name>
- Copyright 2011-2022 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -431,6 +431,10 @@ limitUnused = MatchFiles
isunused k = S.member k <$> unusedKeys
{- Adds a limit that matches anything. -}
addAnything :: Annex ()
addAnything = addLimit (Right limitAnything)
{- Limit that matches any version of any file or key. -}
limitAnything :: MatchFiles Annex
limitAnything = MatchFiles
@ -441,6 +445,10 @@ limitAnything = MatchFiles
, matchNeedsLocationLog = False
}
{- Adds a limit that never matches. -}
addNothing :: Annex ()
addNothing = addLimit (Right limitNothing)
{- Limit that never matches. -}
limitNothing :: MatchFiles Annex
limitNothing = MatchFiles