Documentation ¶
Overview ¶
Package navigation provides the functionality of navigating the filesystem.
Index ¶
- func Ascend(app cli.App)
- func Descend(app cli.App)
- func MutateFiltering(app cli.App, f func(bool) bool)
- func MutateShowHidden(app cli.App, f func(bool) bool)
- func ScrollPreview(app cli.App, delta int)
- func Select(app cli.App, f func(cli.ListBoxState) int)
- func SelectedName(app cli.App) string
- func Start(app cli.App, cfg Config)
- type Config
- type Cursor
- type File
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MutateFiltering ¶
MutateFiltering changes the filtering status of the navigation addon if it is active.
func MutateShowHidden ¶
MutateShowHidden changes whether the navigation addon should show file whose names start with ".".
func ScrollPreview ¶
ScrollPreview scrolls the preview if the navigation addon is currently active.
func Select ¶
func Select(app cli.App, f func(cli.ListBoxState) int)
Select changes the selection if the navigation addon is currently active.
func SelectedName ¶
SelectedName returns the currently selected name in the navigation addon. It returns an empty string if the navigation addon is not active, or if there is no selected name.
Types ¶
type Config ¶
type Config struct { // Key binding. Binding cli.Handler // Underlying filesystem. Cursor Cursor // A function that returns the relative weights of the widths of the 3 // columns. If unspecified, the ratio is 1:3:4. WidthRatio func() [3]int }
Config contains the configuration needed for the navigation functionality.
type Cursor ¶
type Cursor interface { // Current returns a File that represents the current directory. Current() (File, error) // Parent returns a File that represents the parent directory. It may return // nil if the current directory is the root of the filesystem. Parent() (File, error) // Ascend navigates to the parent directory. Ascend() error // Descend navigates to the named child directory. Descend(name string) error }
Cursor represents a cursor for navigating in a potentially virtual filesystem.
type File ¶
type File interface { // Name returns the name of the file. Name() string // ShowName returns a styled filename. ShowName() ui.Text // IsDirDeep returns whether the file is itself a directory or a symlink to // a directory. IsDirDeep() bool // Read returns either a list of File's if the File represents a directory, // a (possibly incomplete) slice of bytes if the File represents a normal // file, or an error if the File cannot be read. Read() ([]File, []byte, error) }
File represents a potentially virtual file.