Documentation
¶
Index ¶
- func IsHidden(file string) (bool, error)
- type KeyMap
- type Model
- func (m Model) DidSelectDisabledFile(msg tea.Msg) (bool, string)
- func (m Model) DidSelectFile(msg tea.Msg) (bool, string)
- func (m Model) GetChosenFiles() []string
- func (m Model) Init() tea.Cmd
- func (m *Model) ResetChosenFiles()
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KeyMap ¶
type KeyMap struct {
GoToTop key.Binding
GoToLast key.Binding
Down key.Binding
Up key.Binding
PageUp key.Binding
PageDown key.Binding
Back key.Binding
Open key.Binding
Select key.Binding
}
KeyMap defines key bindings for each user action.
type Model ¶
type Model struct {
// Path is the path which the user has selected with the file picker.
Path string
// CurrentDirectory is the directory that the user is currently in.
CurrentDirectory string
// AllowedTypes specifies which file types the user may select.
// If empty the user may select any file.
AllowedTypes []string
KeyMap KeyMap
ShowHidden bool
DirAllowed bool
FileAllowed bool
FileSelected string
Height int
AutoHeight bool
Cursor string
Styles Styles
// contains filtered or unexported fields
}
Model represents a file picker.
func New ¶
func New() Model
New returns a new filepicker model with default styling and key bindings.
func (Model) DidSelectDisabledFile ¶
DidSelectDisabledFile returns whether a user tried to select a disabled file (on this msg). This is necessary only if you would like to warn the user that they tried to select a disabled file.
func (Model) DidSelectFile ¶
DidSelectFile returns whether a user has selected a file (on this msg).
func (Model) GetChosenFiles ¶
func (*Model) ResetChosenFiles ¶
func (m *Model) ResetChosenFiles()
type Styles ¶
type Styles struct {
DisabledCursor lipgloss.Style
Cursor lipgloss.Style
Symlink lipgloss.Style
Directory lipgloss.Style
File lipgloss.Style
DisabledFile lipgloss.Style
Permission lipgloss.Style
Selected lipgloss.Style
Chosen lipgloss.Style
SelectedChosen lipgloss.Style
DisabledSelected lipgloss.Style
FileSize lipgloss.Style
EmptyDirectory lipgloss.Style
}
Styles defines the possible customizations for styles in the file picker.
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles defines the default styling for the file picker.
func DefaultStylesWithRenderer ¶
DefaultStylesWithRenderer defines the default styling for the file picker, with a given Lip Gloss renderer.