Documentation
¶
Index ¶
- type DirState
- type Nav
- func (n *Nav) Back(currSelected []string, currCursor string) DirState
- func (n *Nav) ClipboardCopy(selectedNames map[string]struct{}, cut bool)
- func (n *Nav) CurrentPath() string
- func (n *Nav) Delete(ctx context.Context, names []string) []error
- func (n *Nav) Forward(currSelected []string, currCursor string) DirState
- func (n *Nav) GetPreview(ctx context.Context, path string) entry.Preview
- func (n *Nav) Go(path string, currCursor string, currSelected []string) DirState
- func (n *Nav) MkDir(ctx context.Context, name string) []error
- func (n *Nav) MkFile(ctx context.Context, name string) []error
- func (n *Nav) Reload(currSelected []string, currCursor string) DirState
- func (n *Nav) Rename(ctx context.Context, name, newName string) []error
- func (n *Nav) SetDirsMixed(dirsMixed bool)
- func (n *Nav) SetShowHidden(showHidden bool)
- func (n *Nav) ShowHidden() bool
- type NavState
- type PreviewHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirState ¶
type DirState struct { // contains filtered or unexported fields }
DirState represents the state of the directory
func (DirState) BackActive ¶
BackActive returns true if there is a back history
func (DirState) ForwardActive ¶
ForwardActive returns true if there is a forward history
type Nav ¶
type Nav struct {
// contains filtered or unexported fields
}
func NewNav ¶
func NewNav(showHidden bool, dirsMixed bool, startPath string, fsys afero.Fs, previewDelay int, dryRun bool) *Nav
NewNav creates a new Nav struct. The startPath is the path to start the navigation at. The fsys is the filesystem to use. The previewDelay is the delay in milliseconds before previewing a file. If dryRun is true, no changes will be made to the filesystem.
func (*Nav) ClipboardCopy ¶
ClipboardCopy sets the internal clipboard to the selected entries
func (*Nav) CurrentPath ¶
CurrentPath returns the path to the current directory of the navigation instance.
func (*Nav) Delete ¶
Delete removes the files or directories with the given names from the current directory. If the Nav instance is in dry run mode, no files or directories will be removed. Returns a slice of errors encountered during the deletion process.
func (*Nav) GetPreview ¶
GetPreview returns the preview for the file at the given path. The preview is generated using the Nav instance's PreviewHandler.
func (*Nav) Go ¶
Go changes the current directory to the given path and returns a Dirstate struct. If the path is "~", the home directory is used.
func (*Nav) MkDir ¶
MkDir creates a directory with the given name in the current directory. If the Nav instance is in dry run mode, no directory will be created. Returns a slice of errors encountered during the creation process.
func (*Nav) MkFile ¶
MkFile creates a file with the given name in the current directory. If the Nav instance is in dry run mode, no file will be created. Returns a slice of errors encountered during the creation process.
func (*Nav) Rename ¶
Rename renames the file or directory with the given name to the given newName. If the Nav instance is in dry run mode, no files or directories will be renamed. Returns a slice of errors encountered during the rename process.
func (*Nav) SetDirsMixed ¶
func (*Nav) SetShowHidden ¶
func (*Nav) ShowHidden ¶
type NavState ¶
type NavState struct {
// contains filtered or unexported fields
}
NavState represents the state of the navigation within a directory
type PreviewHandler ¶
type PreviewHandler struct {
// contains filtered or unexported fields
}
func NewPreviewHandler ¶
func NewPreviewHandler(ctx context.Context, previewDelay int, maxBytes int, cacheSize int, pruneInterval time.Duration) *PreviewHandler
NewPreviewHandler creates a new PreviewHandler ctx is used to cancel periodic pruning of the cache previewDelay is the delay in milliseconds to wait before reading a file maxBytes is the maximum number of bytes to read from a file to form the preview cacheSize is the maximum number of previews to store in the cache pruneInterval is the interval at which to prune the cache