file

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package file provides an interface to pick a file from a folder (tree). The user is provided a file manager-like interface to navigate, to select a file.

Let's pick a file from the current directory:

$ gum file $ gum file .

Let's pick a file from the home directory:

$ gum file $HOME

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Path is the path to the folder / directory to begin traversing.
	Path string `arg:"" optional:"" name:"path" help:"The path to the folder to begin traversing" env:"GUM_FILE_PATH"`
	// Cursor is the character to display in front of the current selected items.
	Cursor      string        `short:"c" help:"The cursor character" default:">" env:"GUM_FILE_CURSOR"`
	All         bool          `short:"a" help:"Show hidden and 'dot' files" default:"false" env:"GUM_FILE_ALL"`
	Permissions bool          `short:"p" help:"Show file permissions" default:"true" negatable:"" env:"GUM_FILE_PERMISSION"`
	Size        bool          `short:"s" help:"Show file size" default:"true" negatable:"" env:"GUM_FILE_SIZE"`
	File        bool          `help:"Allow files selection" default:"true" env:"GUM_FILE_FILE"`
	Directory   bool          `help:"Allow directories selection" default:"false" env:"GUM_FILE_DIRECTORY"`
	ShowHelp    bool          `help:"Show help key binds" negatable:"" default:"true" env:"GUM_FILE_SHOW_HELP"`
	Timeout     time.Duration `help:"Timeout until command aborts without a selection" default:"0s" env:"GUM_FILE_TIMEOUT"`
	Header      string        `help:"Header value" default:"" env:"GUM_FILE_HEADER"`
	Height      int           `help:"Maximum number of files to display" default:"10" env:"GUM_FILE_HEIGHT"`

	CursorStyle      style.Styles `embed:"" prefix:"cursor." help:"The cursor style" set:"defaultForeground=212" envprefix:"GUM_FILE_CURSOR_"`
	SymlinkStyle     style.Styles `embed:"" prefix:"symlink." help:"The style to use for symlinks" set:"defaultForeground=36" envprefix:"GUM_FILE_SYMLINK_"`
	DirectoryStyle   style.Styles `` /* 127-byte string literal not displayed */
	FileStyle        style.Styles `embed:"" prefix:"file." help:"The style to use for files" envprefix:"GUM_FILE_FILE_"`
	PermissionsStyle style.Styles `` /* 132-byte string literal not displayed */
	SelectedStyle    style.Styles `` //nolint:staticcheck
	/* 155-byte string literal not displayed */
	FileSizeStyle style.Styles `` //nolint:staticcheck
	/* 174-byte string literal not displayed */
	HeaderStyle style.Styles `embed:"" prefix:"header." set:"defaultForeground=99" envprefix:"GUM_FILE_HEADER_"`
	Padding     string       `help:"Padding" default:"${defaultPadding}" group:"Style Flags" env:"GUM_FILE_PADDING"`
}

Options are the options for the file command.

func (Options) Run

func (o Options) Run() error

Run is the interface to picking a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL