shikensu-0.3.5: Run a sequence of functions on in-memory representations of files

Safe HaskellNone
LanguageHaskell2010

Shikensu

Description

Shikensu.

See the README and tests for examples.

Synopsis

Documentation

list :: [String] -> FilePath -> IO Dictionary Source #

Make a single dictionary based on a path to a directory and multiple glob patterns.

  1. Compile patterns so globDir can use them.
  2. Run globDir function on the given (root) path.
  3. We get a list back for each pattern (ie. a list of lists), here we put each child list in a tuple along with its pattern.
  4. We make a Dictionary out of each tuple (this also needs the path).
  5. Merge the dictionaries into one dictionary.
list ["*.md"] "/root/articles"

listF :: FilePath -> [String] -> IO Dictionary Source #

Flipped version of list.

listRelative :: [String] -> FilePath -> IO Dictionary Source #

Same as list, but given a relative directory.

listRelative ["*.md"] "./articles"

makeDefinition :: FilePath -> String -> FilePath -> Definition Source #

Make a Definition.

Example definition, given:

  • the root path `/Users/icidasset/Projects/shikensu`
  • the pattern `example/**/*.md`
  • the absolute path `/Users/icidasset/Projects/shikensu/example/test/hello.md`
Definition
    { basename = "hello"
    , dirname = "test"
    , extname = ".md"
    , pattern = "example/**/*.md"
    , rootDirname = "/Users/icidasset/Projects/shikensu"
    , workingDirname = "example"

    , content = Nothing
    , metadata = HashMap.empty
    , parentPath = "../"
    , pathToRoot = "../../"
    }

makeDictionary :: FilePath -> (String, [FilePath]) -> Dictionary Source #

Make a Dictionary.