summoner-2.0.1.0: Tool for scaffolding fully configured batteries-included production-level Haskell projects.
Copyright(c) 2017-2019 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Summoner.Tree

Description

Data type for representing filesystem structure via tree.

Synopsis

Documentation

data TreeFs Source #

Describes simple structure of filesystem tree.

Constructors

Dir FilePath [TreeFs]

Name of directory (relative) and its containing entries

File FilePath Text

File name (relative) and file content

Instances

Instances details
Eq TreeFs Source # 
Instance details

Defined in Summoner.Tree

Methods

(==) :: TreeFs -> TreeFs -> Bool #

(/=) :: TreeFs -> TreeFs -> Bool #

Ord TreeFs Source # 
Instance details

Defined in Summoner.Tree

Show TreeFs Source # 
Instance details

Defined in Summoner.Tree

Generic TreeFs Source # 
Instance details

Defined in Summoner.Tree

Associated Types

type Rep TreeFs :: Type -> Type #

Methods

from :: TreeFs -> Rep TreeFs x #

to :: Rep TreeFs x -> TreeFs #

type Rep TreeFs Source # 
Instance details

Defined in Summoner.Tree

traverseTree :: TreeFs -> IO () Source #

Walks through directory tree and write file contents, creating all intermediate directories.

pathToTree :: FilePath -> Text -> TreeFs Source #

This function converts a string file path to the tree structure.

For a path like this: ".githubworkflowci.yml"

This function produces the following tree:

.github/
└── workflow/
    └── ci.yml

insertTree :: TreeFs -> [TreeFs] -> [TreeFs] Source #

This functions inserts given TreeFs node into the list of existing TreeFs nodes. The behavior of this function is the following:

  1. It merges duplicating directories.
  2. It overrides existing File with the given TreeFs in case of duplicates.

showBoldTree :: TreeFs -> Text Source #

Pretty shows the directory tree content.

showTree Source #

Arguments

:: Bool

Print directories bold.

-> TreeFs

Given tree.

-> Text

Pretty output.

Pretty shows tree with options.