Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A potentially too simple interface for getting candidates for search from file trees. Doesn't follow symbolic links. For a better solution to this use unix-recursive.
Synopsis
- data Conf = Conf {
- includeFile :: FileStatus -> ByteString -> IO Bool
- filterPath :: ByteString -> Bool
- data FindConf
- = Find !(HashSet ByteString)
- | Ignore !(HashSet ByteString)
- data FindInDirs = FindInDirs {
- confLocal :: FindConf
- dirsLocal :: [ByteString]
- data FileTree a = Dir {}
- defConf :: Conf
- withExts :: [ByteString] -> FindConf
- ignoreExts :: [ByteString] -> FindConf
- findWithExts :: FindInDirs -> IO (Vector (FileTree Text))
- findFilesInDirs :: [FindInDirs] -> IO (Vector (FileTree Text))
- executables :: IO (Vector Text)
- dirContentsWith :: Conf -> ByteString -> IO (Vector (Either ByteString ByteString))
- fileTreeWith :: Conf -> ByteString -> IO (FileTree Text)
- minify :: FileTree Text -> FileTree Text
- flatten :: FileTree Text -> Vector Text
- ext :: ByteString -> ByteString
Types
Conf | |
|
A simple type to represent a search either for a specific set of extensions or esle for excluding a specific set of extensions. An extension here
is just the part of the filename after the last .
i.e this module doesn't handle multiple extensions.
Find !(HashSet ByteString) | |
Ignore !(HashSet ByteString) |
data FindInDirs Source #
FindInDirs | |
|
File Collection
:: [ByteString] | The set of extensions to search for |
-> FindConf |
:: [ByteString] | The set of extensions to ignore. |
-> FindConf |
findWithExts :: FindInDirs -> IO (Vector (FileTree Text)) Source #
findFilesInDirs :: [FindInDirs] -> IO (Vector (FileTree Text)) Source #
Like findWithExts
but applied to mutliple lists of directories each with their own configuration of extensions.
Internal Details
dirContentsWith :: Conf -> ByteString -> IO (Vector (Either ByteString ByteString)) Source #
Given the configuration and a directory returns a vector where the Left elements are the files in the directory that pass the includeFile
test while
the Right elements are subdirectories that pass the filterPath
test.
fileTreeWith :: Conf -> ByteString -> IO (FileTree Text) Source #
Constructs the file tree with the given the second argument at the root according to the given configuration.
minify :: FileTree Text -> FileTree Text Source #
Collapses the directories with only subdirectory and no other files.
flatten :: FileTree Text -> Vector Text Source #
Flattens the fileTree by completing the paths of the file relative to that of root directory.
ext :: ByteString -> ByteString Source #
The last extension of a file. Returns empty bytestring if there is none.