Added --accessedwithin matching option.
Useful for dropping old objects from cache repositories. But also, quite a genrally useful thing to have.. Rather than imitiating find's -atime and other options, all of which are pretty horrible to use, I made this match files accessed within a time period, using the same duration format used by git-annex schedule and --limit-time In passing, changed the --limit-time option parser to parse the duration, instead of having it later throw an error. This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
parent
fd5a392006
commit
6e6c9cc6d3
5 changed files with 56 additions and 11 deletions
|
@ -38,6 +38,7 @@ import CmdLine.Usage
|
|||
import CmdLine.GlobalSetter
|
||||
import qualified Backend
|
||||
import qualified Types.Backend as Backend
|
||||
import Utility.HumanTime
|
||||
|
||||
-- Global options that are accepted by all git-annex sub-commands,
|
||||
-- although not always used.
|
||||
|
@ -275,6 +276,12 @@ nonWorkTreeMatchingOptions' =
|
|||
<> help "match files the repository wants to drop"
|
||||
<> hidden
|
||||
)
|
||||
, globalSetter Limit.addAccessedWithin $ option (str >>= parseDuration)
|
||||
( long "accessedwithin"
|
||||
<> metavar paramTime
|
||||
<> help "match files accessed within a time interval"
|
||||
<> hidden
|
||||
)
|
||||
]
|
||||
|
||||
-- Options to match files which may not yet be annexed.
|
||||
|
@ -371,7 +378,7 @@ jobsOption =
|
|||
|
||||
timeLimitOption :: [GlobalOption]
|
||||
timeLimitOption =
|
||||
[ globalSetter Limit.addTimeLimit $ strOption
|
||||
[ globalSetter Limit.addTimeLimit $ option (str >>= parseDuration)
|
||||
( long "time-limit" <> short 'T' <> metavar paramTime
|
||||
<> help "stop after the specified amount of time"
|
||||
<> hidden
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue