Documentation
¶
Index ¶
- Constants
- Variables
- func Confirm(prompt string) bool
- func ConfirmYes(prompt string) bool
- func InputFilename(file *trash.File) (string, error)
- func Render(manager *trash.Manager, files []*trash.File, cfg *config.Config) ([]*trash.File, error)
- type ConfirmState
- type DateFormat
- type File
- type FileListLoadedMsg
- type FileListUpdatedMsg
- type ListDensityType
- type Model
- type RestoreDelegate
- func (d RestoreDelegate) FullHelp() [][]key.Binding
- func (d RestoreDelegate) Height() int
- func (d RestoreDelegate) Render(w io.Writer, m list.Model, index int, item list.Item)
- func (d RestoreDelegate) ShortHelp() []key.Binding
- func (d RestoreDelegate) Spacing() int
- func (d RestoreDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd
- type RestoreItem
- type RestoreItemStyles
- type SelectionManager
- type ShowDetailMsg
- type ViewState
- func (v *ViewState) BackspaceYesInput()
- func (v *ViewState) ClearYesInput()
- func (v *ViewState) FormatDate(t time.Time) string
- func (v *ViewState) IsYesComplete() bool
- func (v *ViewState) SetConfirmState(state ConfirmState, files []File)
- func (v *ViewState) SetView(newView ViewType)
- func (v *ViewState) ToggleDateFormat()
- func (v *ViewState) ToggleOriginPath()
- func (v *ViewState) UpdateYesInput(char string)
- type ViewType
Constants ¶
const ( CompactDensityVal = "compact" SpaciousDensityVal = "spacious" )
Density configuration values
const ( PaginatorDots = "dots" PaginatorArabic = "arabic" )
Variables ¶
var ( ErrCannotPreview = errors.New("cannot preview") ErrInputCanceled = errors.New("input is canceled") )
Common errors
Functions ¶
func ConfirmYes ¶ added in v1.6.0
Types ¶
type ConfirmState ¶ added in v1.6.0
type ConfirmState string
ConfirmState represents the confirmation dialog state
const ( ConfirmStateYesNo ConfirmState = "yn" ConfirmStateTypeYES ConfirmState = "yes" )
type DateFormat ¶ added in v1.5.0
type DateFormat string
DateFormat represents the date display format
const ( DateFormatRelative DateFormat = "relative" DateFormatAbsolute DateFormat = "absolute" )
type FileListLoadedMsg ¶ added in v1.5.0
type FileListLoadedMsg struct {
// contains filtered or unexported fields
}
FileListLoadedMsg indicates the initial file list has been loaded
type FileListUpdatedMsg ¶ added in v1.5.0
type FileListUpdatedMsg struct {
// contains filtered or unexported fields
}
FileListUpdatedMsg represents an update to the existing file list
type ListDensityType ¶
type ListDensityType uint8
ListDensityType represents the density of the list view
const ( // Compact shows items without descriptions Compact ListDensityType = iota // Spacious shows items with descriptions Spacious )
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model represents the main UI model following the Bubble Tea pattern
type RestoreDelegate ¶
type RestoreDelegate struct {
Styles RestoreItemStyles
UpdateFunc func(tea.Msg, *list.Model) tea.Cmd
ShortHelpFunc func() []key.Binding
FullHelpFunc func() [][]key.Binding
// contains filtered or unexported fields
}
func NewRestoreDelegate ¶
func NewRestoreDelegate(cfg config.UI, files []File) RestoreDelegate
NewRestoreDelegate creates a new delegate with Restore styles.
func (RestoreDelegate) FullHelp ¶
func (d RestoreDelegate) FullHelp() [][]key.Binding
func (RestoreDelegate) Height ¶
func (d RestoreDelegate) Height() int
func (RestoreDelegate) ShortHelp ¶
func (d RestoreDelegate) ShortHelp() []key.Binding
func (RestoreDelegate) Spacing ¶
func (d RestoreDelegate) Spacing() int
type RestoreItem ¶
RestoreItem describes an item designed to work with RestoreDelegate.
type RestoreItemStyles ¶
type RestoreItemStyles struct {
NormalTitle lipgloss.Style
NormalDesc lipgloss.Style
CursorTitle lipgloss.Style
CursorDesc lipgloss.Style
SelectedTitle lipgloss.Style
SelectedDesc lipgloss.Style
SelectedCursorTitle lipgloss.Style
SelectedCursorDesc lipgloss.Style
DimmedTitle lipgloss.Style
DimmedDesc lipgloss.Style
FilterMatch lipgloss.Style
FilterPrompt lipgloss.Style
}
func NewRestoreItemStyles ¶
func NewRestoreItemStyles(cfg config.UI) (s RestoreItemStyles)
type SelectionManager ¶
type SelectionManager struct {
// contains filtered or unexported fields
}
func (*SelectionManager) Add ¶
func (r *SelectionManager) Add(item File)
func (*SelectionManager) Contains ¶
func (r *SelectionManager) Contains(item File) bool
func (*SelectionManager) IndexOf ¶
func (r *SelectionManager) IndexOf(item File) int
func (*SelectionManager) Remove ¶
func (r *SelectionManager) Remove(item File)
type ShowDetailMsg ¶ added in v1.5.0
type ShowDetailMsg struct {
// contains filtered or unexported fields
}
ShowDetailMsg represents a request to switch to detail view
type ViewState ¶ added in v1.5.0
type ViewState struct {
// contains filtered or unexported fields
}
func NewViewState ¶ added in v1.5.0
func NewViewState() *ViewState
NewViewState creates a new ViewState with default values
func (*ViewState) BackspaceYesInput ¶ added in v1.6.0
func (v *ViewState) BackspaceYesInput()
BackspaceYesInput removes the last character from YES input
func (*ViewState) ClearYesInput ¶ added in v1.6.0
func (v *ViewState) ClearYesInput()
ClearYesInput clears the YES input
func (*ViewState) FormatDate ¶ added in v1.5.0
FormatDate formats the given time according to the current date format
func (*ViewState) IsYesComplete ¶ added in v1.6.0
IsYesComplete checks if the complete "YES" has been entered
func (*ViewState) SetConfirmState ¶ added in v1.6.0
func (v *ViewState) SetConfirmState(state ConfirmState, files []File)
SetConfirmState sets the confirmation dialog state
func (*ViewState) SetView ¶ added in v1.5.0
SetView changes the current view and updates the previous view
func (*ViewState) ToggleDateFormat ¶ added in v1.5.0
func (v *ViewState) ToggleDateFormat()
ToggleDateFormat switches between relative and absolute date formats
func (*ViewState) ToggleOriginPath ¶ added in v1.5.0
func (v *ViewState) ToggleOriginPath()
ToggleOriginPath switches between showing origin and trash paths
func (*ViewState) UpdateYesInput ¶ added in v1.6.0
UpdateYesInput updates the YES input state