brick-filetree-0.1.0.3

Safe HaskellNone
LanguageHaskell2010

Brick.Widgets.FileTree

Contents

Synopsis

Types

data FileTree a Source #

Represents all the state required to interact with or display a filetree

newFileTree :: ValueLoader a -> FilePath -> IO (FileTree a) Source #

Create a new FileTree situated at the given FilePath

The given ValueLoader will be used to load additional context for each filepath (dirs AND files). It will be called lazily using unsafeInterleaveIO when the value itself is accessed (if ever).

Interaction

moveUp :: FileTree a -> EventM String (FileTree a) Source #

Move the cursor up one item

moveDown :: FileTree a -> EventM String (FileTree a) Source #

Move the cursor down one item

pageUp :: FileTree a -> EventM String (FileTree a) Source #

Move the cursor up a page

pageDown :: FileTree a -> EventM String (FileTree a) Source #

Move the cursor down a page

moveToTop :: FileTree a -> EventM String (FileTree a) Source #

Move the cursor the the top of the file list

moveToBottom :: FileTree a -> EventM String (FileTree a) Source #

Move the cursor the the bottom of the file list

ascendDir :: FileTree a -> EventM String (FileTree a) Source #

Move the cursor up a directory in the file tree

descendDir :: FileTree a -> EventM String (FileTree a) Source #

If the cursor is on a directory then descend the cursor into that dir If the cursor is on a file nothing happens

toggleFlagged :: FileTree a -> EventM String (FileTree a) Source #

Flag or unflag the current file or dir

toggleFlaggedVisible :: FileTree a -> FileTree a Source #

Hide/Show a list of all flagged files

Queries

getCurrentFilePath :: FileTree a -> Maybe FilePath Source #

Get the absolute path of the object (dir or file) under the cursor

getCurrentDir :: FileTree a -> FilePath Source #

Get the absolute path of the directory where the cursor currently is.

getFlagged :: FileTree a -> [FilePath] Source #

Get all flagged file paths. All paths are absolute

Rendering

renderFileTreeCustom :: CustomFCRender a -> FileTree a -> Widget String Source #

Attributes

flaggedItemAttr :: AttrName Source #

Flagged items are rendered with this attr

titleAttr :: AttrName Source #

UI Titles have this attr

dirAttr :: AttrName Source #

Directories in the list have this attr

fileAttr :: AttrName Source #

Files in the list have this attr

errorAttr :: AttrName Source #

Errors have this attr