talash-0.1.1.1: Line oriented fast enough text search
Safe HaskellNone
LanguageHaskell2010

Talash.Files

Description

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

Types

data Conf Source #

Constructors

Conf 

Fields

data FindConf Source #

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.

Instances

Instances details
Show FindConf Source # 
Instance details

Defined in Talash.Files

data FindInDirs Source #

Constructors

FindInDirs 

Fields

  • confLocal :: FindConf

    The configuration of finding or excluding the extensions for this set of directories.

  • dirsLocal :: [ByteString]

    The list of directories to which this configuration should apply.

data FileTree a Source #

Constructors

Dir

The vector of trees formed by subdirectories

Fields

Instances

Instances details
Eq a => Eq (FileTree a) Source # 
Instance details

Defined in Talash.Files

Methods

(==) :: FileTree a -> FileTree a -> Bool #

(/=) :: FileTree a -> FileTree a -> Bool #

Show a => Show (FileTree a) Source # 
Instance details

Defined in Talash.Files

Methods

showsPrec :: Int -> FileTree a -> ShowS #

show :: FileTree a -> String #

showList :: [FileTree a] -> ShowS #

File Collection

defConf :: Conf Source #

Default configuration, include every file and search directory.

withExts Source #

Arguments

:: [ByteString]

The set of extensions to search for

-> FindConf 

ignoreExts Source #

Arguments

:: [ByteString]

The set of extensions to ignore.

-> FindConf 

findWithExts :: FindInDirs -> IO (Vector (FileTree Text)) Source #

Find files in the given set of directories that either have a specific extension (Find case) or else excluding a certain set of extensiosn (Ignore case).

findFilesInDirs :: [FindInDirs] -> IO (Vector (FileTree Text)) Source #

Like findWithExts but applied to mutliple lists of directories each with their own configuration of extensions.

executables :: IO (Vector Text) Source #

Find all the executables in PATH

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.