filetree

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdleState treeState = iota
	CreateFileState
	CreateDirectoryState
	MoveState
	RenameState
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryItem

type DirectoryItem struct {
	Name        string
	Details     string
	Path        string
	Extension   string
	FileSize    string
	IsDirectory bool
	FileInfo    os.FileInfo
}

type Model

type Model struct {
	Cursor int

	Disabled bool

	StatusMessage string

	StatusMessageLifetime time.Duration

	CurrentDirectory string
	State            treeState
	// contains filtered or unexported fields
}

func New

func New(startDir string) Model

func (*Model) CreateDirectoryCmd

func (m *Model) CreateDirectoryCmd(name string) tea.Cmd

CreateDirectoryCmd creates a directory based on the name provided.

func (*Model) CreateFileCmd

func (m *Model) CreateFileCmd(name string) tea.Cmd

CreateFileCmd creates a file based on the name provided.

func (Model) GetDirectoryListingCmd

func (m Model) GetDirectoryListingCmd(directoryName string) tea.Cmd

GetDirectoryListingCmd updates the directory listing based on the name of the directory provided.

func (Model) GetSelectedItem

func (m Model) GetSelectedItem() DirectoryItem

GetSelectedItem returns the currently selected file/dir.

func (Model) GetTotalItems

func (m Model) GetTotalItems() int

GetTotalItems returns total number of tree items.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) MoveDirectoryItemCmd

func (m Model) MoveDirectoryItemCmd(source, destination string) tea.Cmd

MoveDirectoryItemCmd moves an item from one place to another.

func (*Model) NewStatusMessageCmd

func (m *Model) NewStatusMessageCmd(s string) tea.Cmd

NewStatusMessageCmd sets a new status message, which will show for a limited amount of time. Note that this also returns a command.

func (*Model) RenameDirectoryItemCmd

func (m *Model) RenameDirectoryItemCmd(originalName, newName string) tea.Cmd

RenameDirectoryItemCmd renames a file or folder given a name.

func (*Model) SetDisabled

func (m *Model) SetDisabled(disabled bool)

SetDisabled sets if the bubble is currently active.

func (*Model) SetSelectionPath

func (m *Model) SetSelectionPath(path string)

SetSelectionPath sets the selection path to be written.

func (*Model) SetShowIcons

func (m *Model) SetShowIcons(show bool)

SetShowIcons sets whether icons will show or not.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize Sets the size of the filetree.

func (*Model) SetTheme

func (m *Model) SetTheme(selectedItemColor, unselectedItemColor lipgloss.AdaptiveColor)

SetTheme sets the theme of the tree.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

func (Model) View

func (m Model) View() string

Jump to

Keyboard shortcuts

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