tui

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(argv0 string, argv, envv []string) error

Execute runs given bin path via exec.Command call

Types

type CollapsedPath

type CollapsedPath struct {
	DisplayName string   // The display name shown in the UI (e.g., "a/b/c")
	DeepestDir  fs.Item  // The actual deepest directory item
	Segments    []string // Individual path segments of the collapsed chain
}

CollapsedPath represents a directory chain that can be collapsed into a single display entry. For example, if directory "a" contains only directory "b", and "b" contains only "c", this represents the collapsed path "a/b/c" that allows direct navigation to the deepest directory.

type DeleteAction added in v0.3.0

type DeleteAction uint8

DeleteAction selects how an item is removed from the directory tree.

const (
	ActionDelete DeleteAction = iota
	ActionEmpty
	ActionMoveToTrash
)

func (DeleteAction) Acting added in v0.3.0

func (a DeleteAction) Acting() string

func (DeleteAction) Verb added in v0.3.0

func (a DeleteAction) Verb() string

type Option

type Option func(ui *UI)

Option is optional function customizing the behaviour of UI

type ProgressBar

type ProgressBar struct {
	*tview.Box
	// contains filtered or unexported fields
}

ProgressBar is a tview primitive that renders a horizontal progress bar. It embeds tview.Box so it participates in layout and can optionally have a border and title.

func NewProgressBar

func NewProgressBar() *ProgressBar

NewProgressBar returns a new ProgressBar with default settings.

func (*ProgressBar) Draw

func (p *ProgressBar) Draw(screen tcell.Screen)

Draw implements tview.Primitive. It draws the border (via Box.Draw) and then fills the inner rect with a segmented progress bar.

func (*ProgressBar) GetProgress

func (p *ProgressBar) GetProgress() int

GetProgress returns the current progress in the range [0, 100].

func (*ProgressBar) SetProgress

func (p *ProgressBar) SetProgress(progress int)

SetProgress sets the current progress in the range [0, 100].

func (*ProgressBar) SetUseColor

func (p *ProgressBar) SetUseColor(use bool) *ProgressBar

SetUseColor controls whether the filled segment is highlighted with colour.

type ResultRow

type ResultRow struct {
	NumberColor    string
	DirectoryColor string
}

ResultRow is a struct for a row in the result table

type UI

type UI struct {
	*common.UI
	// contains filtered or unexported fields
}

UI struct

func CreateUI

func CreateUI(
	app common.TermApplication,
	screen tcell.Screen,
	output io.Writer,
	useColors bool,
	showApparentSize bool,
	showRelativeSize bool,
	useSIPrefix bool,
	opts ...Option,
) *UI

CreateUI creates the whole UI app

func (*UI) AnalyzePath

func (ui *UI) AnalyzePath(path string, parentDir fs.Item) error

AnalyzePath analyzes recursively disk usage for given path

func (*UI) ListDevices

func (ui *UI) ListDevices(getter device.DevicesInfoGetter) error

ListDevices lists mounted devices and shows their disk usage

func (*UI) ReadAnalysis

func (ui *UI) ReadAnalysis(input io.Reader) error

ReadAnalysis reads analysis report from JSON file

func (*UI) ReadFromStorage

func (ui *UI) ReadFromStorage(storagePath, path string) error

ReadFromStorage reads analysis data from persistent key-value storage

func (*UI) SetBrowseParentDirs

func (ui *UI) SetBrowseParentDirs()

SetBrowseParentDirs enables navigating above the launch directory

func (*UI) SetChangeCwdFn

func (ui *UI) SetChangeCwdFn(fn func(string) error)

SetChangeCwdFn sets function that can be used to change current working dir during dir browsing

func (*UI) SetCollapsePath

func (ui *UI) SetCollapsePath(value bool)

SetCollapsePath sets the flag to collapse paths

func (*UI) SetConfirmQuit added in v0.3.0

func (ui *UI) SetConfirmQuit(value bool)

SetConfirmQuit sets whether gdu asks for confirmation before quitting after a scan that took a noticeable amount of time

func (*UI) SetCurrentItemNameMaxLen

func (ui *UI) SetCurrentItemNameMaxLen(maxLen int)

SetCurrentItemNameMaxLen sets the maximum length of the path of the currently processed item to be shown in the progress modal

func (*UI) SetDefaultSorting

func (ui *UI) SetDefaultSorting(by, order string)

SetDefaultSorting sets the default sorting

func (*UI) SetDeleteInBackground

func (ui *UI) SetDeleteInBackground()

SetDeleteInBackground sets the flag to delete files in background

func (*UI) SetDeleteInParallel

func (ui *UI) SetDeleteInParallel()

SetDeleteInParallel sets the flag to delete files in parallel

func (*UI) SetFooterBackgroundColor

func (ui *UI) SetFooterBackgroundColor(color string)

SetFooterBackgroundColor sets the color for the footer background

func (*UI) SetFooterNumberColor

func (ui *UI) SetFooterNumberColor(color string)

SetFooterNumberColor sets the color for the footer number

func (*UI) SetFooterTextColor

func (ui *UI) SetFooterTextColor(color string)

SetFooterTextColor sets the color for the footer text

func (*UI) SetHeaderBackgroundColor

func (ui *UI) SetHeaderBackgroundColor(color string)

SetHeaderBackgroundColor sets the color for the header background

func (*UI) SetHeaderHidden

func (ui *UI) SetHeaderHidden()

SetHeaderHidden sets the flag to hide the header

func (*UI) SetHeaderTextColor

func (ui *UI) SetHeaderTextColor(color string)

SetHeaderTextColor sets the color for the header text

func (*UI) SetMarkedBackgroundColor added in v0.3.0

func (ui *UI) SetMarkedBackgroundColor(color tcell.Color)

SetMarkedBackgroundColor sets the background color for marked items

func (*UI) SetMarkedTextColor added in v0.3.0

func (ui *UI) SetMarkedTextColor(color tcell.Color)

SetMarkedTextColor sets the text color for marked items

func (*UI) SetNoDelete

func (ui *UI) SetNoDelete()

SetNoDelete disables all write operations

func (*UI) SetNoDeleteWithFilter

func (ui *UI) SetNoDeleteWithFilter()

SetNoDelete disables delete when time filters are active

func (*UI) SetNoSpawnShell

func (ui *UI) SetNoSpawnShell()

SetNoSpawnShell disables shell spawning

func (*UI) SetNoViewFile

func (ui *UI) SetNoViewFile()

func (*UI) SetResultRowDirectoryColor

func (ui *UI) SetResultRowDirectoryColor(color string)

SetResultRowDirectoryColor sets the color for the result row directory

func (*UI) SetResultRowNumberColor

func (ui *UI) SetResultRowNumberColor(color string)

SetResultRowNumberColor sets the color for the result row number

func (*UI) SetSelectedBackgroundColor

func (ui *UI) SetSelectedBackgroundColor(color tcell.Color)

SetSelectedBackgroundColor sets the color for the highlighted selected text

func (*UI) SetSelectedTextColor

func (ui *UI) SetSelectedTextColor(color tcell.Color)

SetSelectedTextColor sets the color for the highlighted selected text

func (*UI) SetShowBarPercentage added in v0.3.0

func (ui *UI) SetShowBarPercentage()

SetShowBarPercentage shows the numeric usage percentage next to the size bar

func (*UI) SetShowDiskProgressBar

func (ui *UI) SetShowDiskProgressBar(value bool)

SetShowDiskProgressBar sets whether to show a progress bar when scanning a whole disk

func (*UI) SetShowItemCount

func (ui *UI) SetShowItemCount()

SetShowItemCount sets the flag to show number of items in directory

func (*UI) SetShowMTime

func (ui *UI) SetShowMTime()

SetShowMTime sets the flag to show last modification time of items in directory

func (*UI) SetShowSymlinkTarget added in v0.3.0

func (ui *UI) SetShowSymlinkTarget(value bool)

SetShowSymlinkTarget enables displaying the symlink target (name -> target)

func (*UI) SetTimeFilterWithInfo

func (ui *UI) SetTimeFilterWithInfo(tf *timefilter.TimeFilter, loc *time.Location)

SetTimeFilterWithInfo sets both the time filter function and stores the filter info for display

func (*UI) StartUILoop

func (ui *UI) StartUILoop() error

StartUILoop starts tview application

func (*UI) UseOldSizeBar

func (ui *UI) UseOldSizeBar()

UseOldSizeBar uses the old size bar (# chars) instead of the new one (unicode block elements)

Jump to

Keyboard shortcuts

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