Documentation ¶
Overview ¶
Package filetree implements a filetree bubble which can be used to navigate the filesystem and perform actions on files and directories.
Index ¶
- func ConvertBytesToSizeString(size int64) string
- type Item
- type Model
- func (m Model) Cursor() int
- func (m Model) GetSelectedItem() Item
- func (m Model) Init() tea.Cmd
- func (m Model) IsFiltering() bool
- func (m *Model) SetBorderColor(color lipgloss.AdaptiveColor)
- func (m *Model) SetBorderless(borderless bool)
- func (m *Model) SetIsActive(active bool)
- func (m *Model) SetSelectedItemColors(foreground lipgloss.AdaptiveColor)
- func (m *Model) SetSelectionPath(path string)
- func (m *Model) SetSize(width, height int)
- func (m *Model) SetStartDir(dir string)
- func (m *Model) SetTitleColors(foreground, background lipgloss.AdaptiveColor)
- func (m *Model) ToggleHelp(showHelp bool)
- func (m *Model) ToggleShowIcons(showIcons bool) tea.Cmd
- func (m Model) TotalItems() int
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertBytesToSizeString ¶
ConvertBytesToSizeString converts a byte count to a human readable string.
Types ¶
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents a list item.
func (Item) CurrentDirectory ¶
CurrentDirectory returns the current directory of the tree.
func (Item) Description ¶
Description returns the description of the list item.
func (Item) FileExtension ¶
FileExtension returns the extension of the list item.
func (Item) FilterValue ¶
FilterValue returns the current filter value.
func (Item) IsDirectory ¶
IsDirectory returns true if the list item is a directory.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Bubble represents the properties of a filetree.
func New ¶
func New( active, borderless bool, startDir, selectionPath string, borderColor, selectedItemColor, titleBackgroundColor, titleForegroundColor lipgloss.AdaptiveColor, ) Model
New creates a new instance of a filetree.
func (Model) GetSelectedItem ¶
GetSelectedItem returns the currently selected item in the tree.
func (Model) IsFiltering ¶
IsFiltering returns if the tree is currently being filtered.
func (*Model) SetBorderColor ¶
func (m *Model) SetBorderColor(color lipgloss.AdaptiveColor)
SetBorderColor sets the color of the border.
func (*Model) SetBorderless ¶
SetBorderless sets weather or not to show the border.
func (*Model) SetIsActive ¶
SetIsActive sets if the bubble is currently active.
func (*Model) SetSelectedItemColors ¶
func (m *Model) SetSelectedItemColors(foreground lipgloss.AdaptiveColor)
SetSelectedItemColors sets the foreground of the selected item.
func (*Model) SetSelectionPath ¶
SetSelectionPath sets the path in which to write to a file when editing.
func (*Model) SetStartDir ¶
SetStartDir sets a starting directory.
func (*Model) SetTitleColors ¶
func (m *Model) SetTitleColors(foreground, background lipgloss.AdaptiveColor)
SetTitleColors sets the background and foreground of the title.
func (*Model) ToggleHelp ¶
ToggleHelp sets weather or not to show the help section.
func (*Model) ToggleShowIcons ¶
ToggleShowIcons sets weather or not to show icons.
func (Model) TotalItems ¶
TotalItems returns the total number of items in the tree.