Documentation
¶
Overview ¶
Package megafile provides functionality for a simple TUI for browsing files and directories
Index ¶
Constants ¶
const ( // NoAction - take no action NoAction = iota // NextFile - go to the next file NextFile // PreviousFile - go to the previous file PreviousFile // StopParent - stop the parent process StopParent )
Variables ¶
var ErrExit = errors.New("exit")
ErrExit is the error that is returned if the user appeared to want to exit
Functions ¶
func SetupResizeSignal ¶ added in v1.3.14
SetupResizeSignal sets up window resize signal handling (Unix implementation)
func UpsieString ¶ added in v1.4.3
UpsieString returns a string describing the hostname, kernel/os, and platform. Colors are used unless NO_COLOR=1 is set.
Types ¶
type Action ¶ added in v1.3.5
type Action int
Action is an "enum" for Orbiton to request an action via stderr
type FileEntry ¶ added in v1.2.0
type FileEntry struct {
// contains filtered or unexported fields
}
FileEntry represents a file entry with position and name information
type State ¶
type State struct {
Header string // title/header
Directories []string
AngleColor vt.AttributeColor
PromptColor vt.AttributeColor
HeaderColor vt.AttributeColor
HighlightForeground vt.AttributeColor
HighlightBackground vt.AttributeColor
Background vt.AttributeColor
EdgeBackground vt.AttributeColor
WrittenTextColor vt.AttributeColor
SymlinkDirColor vt.AttributeColor
DirColor vt.AttributeColor
SymlinkFileColor vt.AttributeColor
EmptyFileColor vt.AttributeColor
ExecutableColor vt.AttributeColor
BinaryColor vt.AttributeColor
FileColor vt.AttributeColor
BinaryConfirmForeground vt.AttributeColor
BinaryConfirmBackground vt.AttributeColor
SyntaxTextConfig *synhi.TextConfig // theme colors for syntax highlighting in previews
Light bool // true if the theme has a light background
ShowHidden bool
// contains filtered or unexported fields
}
State holds the current state of the shell, then canvas and the directory structures
func New ¶ added in v1.2.7
func New(c *vt.Canvas, tty *vt.TTY, startdirs []string, header, editor, undoHistoryPath string) *State
New creates a new MegaFile State c and tty is a canvas and TTY, initiated with the vt package startdirs is a slice of directories to browse (toggle with tab) header is the string to display at the top of the screen the function returns the absolute path to the directory the user ended up in, and an error if something went wrong
func (*State) FullResetRedraw ¶ added in v1.3.14
func (s *State) FullResetRedraw()
FullResetRedraw will completely reset and redraw everything, including creating a brand new Canvas struct. Only redraws when in file browsing mode, not when an external editor/command is running.
func (*State) RealPath ¶ added in v1.3.14
RealPath checks if the current path is the same if symlinks are not followed (pwd -P) (the "real" path)
func (*State) ResetTerminal ¶ added in v1.6.19
func (s *State) ResetTerminal()
ResetTerminal resets the VT terminal and creates a fresh canvas, without redrawing any content. Use this when the screen will be immediately taken over by another external command.
