Safe Haskell | None |
---|---|
Language | Haskell2010 |
Shikensu.
See the README and tests for examples.
- list :: [Pattern] -> FilePath -> IO Dictionary
- listF :: FilePath -> [Pattern] -> IO Dictionary
- listRelative :: [Pattern] -> FilePath -> IO Dictionary
- listRelativeF :: FilePath -> [Pattern] -> IO Dictionary
- forkDefinition :: FilePath -> Definition -> Definition
- makeDefinition :: FilePath -> Pattern -> FilePath -> Definition
- makeDictionary :: FilePath -> Pattern -> [FilePath] -> Dictionary
Documentation
list :: [Pattern] -> FilePath -> IO Dictionary Source #
Make a single dictionary based on a path to a directory and multiple glob patterns.
- Compile patterns so
globDir
can use them. - Run
globDir
function on the given (root) path. - 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.
- We make a Dictionary out of each tuple (this also needs the path).
- Merge the dictionaries into one dictionary.
listRelative :: [Pattern] -> FilePath -> IO Dictionary Source #
Same as list
, but given a relative directory.
listRelative ["*.md"] ./articles
listRelativeF :: FilePath -> [Pattern] -> IO Dictionary Source #
Flipped version listRelative
.
forkDefinition :: FilePath -> Definition -> Definition Source #
Fork a Definition.
makeDefinition :: FilePath -> Pattern -> FilePath -> Definition Source #
Make a Definition.
Example definition, given:
- the root path `/Users/icidasset/Projects/shikensu`
- the pattern `example/**/*.md`
- the workspace path `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 -> Pattern -> [FilePath] -> Dictionary Source #
Make a Dictionary.