dirtree

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	Files               []fs.DirEntry
	FilePaths           []string
	Width               int
	Cursor              int
	ShowIcons           bool
	ShowHidden          bool
	SelectedItemColor   lipgloss.AdaptiveColor
	UnselectedItemColor lipgloss.AdaptiveColor
}

Model is a struct to represent the properties of a dirtree.

func NewModel

func NewModel(showIcons bool, selectedItemColor, unselectedItemColor lipgloss.AdaptiveColor) Model

NewModel creates a new instance of a dirtree.

func (Model) GetCursor

func (m Model) GetCursor() int

GetCursor gets the position of the cursor in the tree.

func (Model) GetFilePaths added in v0.8.0

func (m Model) GetFilePaths() []string

GetFilePaths returns an array of file paths.

func (Model) GetSelectedFile

func (m Model) GetSelectedFile() (os.FileInfo, error)

GetSelectedFile returns the currently selected file in the tree.

func (Model) GetTotalFiles

func (m Model) GetTotalFiles() int

GetTotalFiles returns the total number of files in the tree.

func (*Model) GoDown

func (m *Model) GoDown()

GoDown goes down the tree by one.

func (*Model) GoUp

func (m *Model) GoUp()

GoUp goes up the tree by one.

func (*Model) GotoBottom

func (m *Model) GotoBottom()

GotoBottom goes to the bottom of the tree.

func (*Model) GotoTop

func (m *Model) GotoTop()

GotoTop goes to the top of the tree.

func (*Model) SetContent

func (m *Model) SetContent(files []fs.DirEntry)

SetContent sets the files currently displayed in the tree.

func (*Model) SetFilePaths added in v0.8.0

func (m *Model) SetFilePaths(filePaths []string)

SetFilePaths sets an array of file paths.

func (*Model) SetSize added in v0.0.6

func (m *Model) SetSize(width int)

SetSize updates the size of the dirtree, useful when resizing the terminal.

func (*Model) ToggleHidden

func (m *Model) ToggleHidden()

ToggleHidden toggles the visibility of hidden files.

func (Model) View

func (m Model) View() string

View returns a string representation of the current tree.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL