elvish: github.com/elves/elvish/pkg/cli/addons/navigation Index | Files

package navigation

import "github.com/elves/elvish/pkg/cli/addons/navigation"

Package navigation provides the functionality of navigating the filesystem.

Index

Package Files

cursor.go navigation.go

func Ascend Uses

func Ascend(app cli.App)

Ascend ascends in the navigation addon if it is active.

func Descend Uses

func Descend(app cli.App)

Descend descends in the navigation addon if it is active.

func MutateFiltering Uses

func MutateFiltering(app cli.App, f func(bool) bool)

MutateFiltering changes the filtering status of the navigation addon if it is active.

func MutateShowHidden Uses

func MutateShowHidden(app cli.App, f func(bool) bool)

MutateFiltering changes whether the navigation addon should show file whose names start with ".".

func ScrollPreview Uses

func ScrollPreview(app cli.App, delta int)

ScrollPreview scrolls the preview if the navigation addon is currently active.

func Select Uses

func Select(app cli.App, f func(cli.ListBoxState) int)

Select changes the selection if the navigation addon is currently active.

func SelectedName Uses

func SelectedName(app cli.App) string

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.

func Start Uses

func Start(app cli.App, cfg Config)

Start starts the navigation function.

type Config Uses

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 Uses

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.

func NewOSCursor Uses

func NewOSCursor() Cursor

NewOSCursor returns a Cursor backed by the OS.

type File Uses

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.

Package navigation imports 13 packages (graph) and is imported by 2 packages. Updated 2019-12-31. Refresh now. Tools for package owners.