import: Support file matching options such as --exclude, --include, --smallerthan, --largerthan
This commit is contained in:
parent
9723333d86
commit
dfab5e6ff4
3 changed files with 16 additions and 3 deletions
|
@ -66,14 +66,20 @@ withFilesInRefs a = mapM_ go
|
|||
void $ commandAction $ a f k
|
||||
|
||||
withPathContents :: ((FilePath, FilePath) -> CommandStart) -> CommandSeek
|
||||
withPathContents a params = seekActions $
|
||||
map a . concat <$> liftIO (mapM get params)
|
||||
withPathContents a params = do
|
||||
matcher <- Limit.getMatcher
|
||||
seekActions $ map a <$> (filterM (checkmatch matcher) =<< ps)
|
||||
where
|
||||
ps = concat <$> liftIO (mapM get params)
|
||||
get p = ifM (isDirectory <$> getFileStatus p)
|
||||
( map (\f -> (f, makeRelative (parentDir p) f))
|
||||
<$> dirContentsRecursiveSkipping (".git" `isSuffixOf`) True p
|
||||
, return [(p, takeFileName p)]
|
||||
)
|
||||
checkmatch matcher (f, relf) = matcher $ MatchingFile $ FileInfo
|
||||
{ relFile = f
|
||||
, matchFile = relf
|
||||
}
|
||||
|
||||
withWords :: ([String] -> CommandStart) -> CommandSeek
|
||||
withWords a params = seekActions $ return [a params]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue