diff options
author | Joey Hess <joey@kitenet.net> | 2012-05-31 19:47:18 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-05-31 19:47:18 -0400 |
commit | 3a10095d40cf9a9e0380b6b10e1ebe304f1537c0 (patch) | |
tree | a4dd1413473cddc7e7d5aff9ce1442b35347ed4e /Seek.hs | |
parent | 3b09281b442e794213f2e296e42e2d74fddec733 (diff) |
import: New subcommand, pulls files from a directory outside the annex and adds them
Use case for this was developed somewhere on the Transiberian Railroad.
Diffstat (limited to 'Seek.hs')
-rw-r--r-- | Seek.hs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -4,7 +4,7 @@ - the values a user passes to a command, and prepare actions operating - on them. - - - Copyright 2010-2011 Joey Hess <joey@kitenet.net> + - Copyright 2010-2012 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -41,6 +41,14 @@ withFilesNotInGit a params = do g <- gitRepo liftIO $ (\p -> LsFiles.notInRepo force p g) l +withPathContents :: ((FilePath, FilePath) -> CommandStart) -> CommandSeek +withPathContents a params = map a . concat <$> liftIO (mapM get params) + where + get p = ifM (isDirectory <$> getFileStatus p) + ( map (\f -> (f, makeRelative p f)) <$> dirContentsRecursive p + , return [(p, takeFileName p)] + ) + withWords :: ([String] -> CommandStart) -> CommandSeek withWords a params = return [a params] |