lib

package
v1.5.11 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// header+footer
	ExtraRows = 5

	HelpFooter = "?:help | "
)
View Source
const RWRR = 0755

Variables

View Source
var (

	// Cells in selected columns will be highlighted
	StyleSelected = lipgloss.NewStyle().
					Background(lipgloss.Color("#696969")).
					Foreground(lipgloss.Color("#ffffff")).
					Align(lipgloss.Left)

	StyleHeader = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#ff4500")).
				Align(lipgloss.Left).Bold(true)

	// help buffer styles
	StyleKey  = lipgloss.NewStyle().Bold(true)
	StyleHelp = lipgloss.NewStyle().Foreground(lipgloss.Color("#ff4500"))

	// the default style
	NoStyle = lipgloss.NewStyle().Align(lipgloss.Left)

	HelpData = []HelpColumn{
		{
			HelpLine{"up", "navigate up"},
			HelpLine{"down", "navigate down"},
			HelpLine{"tab", "navigate columns"},
		},
		{
			HelpLine{"s", "sort alpha-numerically"},
			HelpLine{"n", "sort numerically"},
			HelpLine{"t", "sort by time"},
			HelpLine{"d", "sort by duration"},
		},
		{
			HelpLine{"spc", "[de]select a row"},
			HelpLine{"a", "[de]select all visible rows"},
			HelpLine{"f", "enter fuzzy filter"},
			HelpLine{"esc", "finish filter input"},
		},
		{
			HelpLine{"?", "show help buffer"},
			HelpLine{"q", "commit and quit"},
			HelpLine{"c-c", "discard and quit"},
		},
	}

	// rendered from Help above
	Help = ""

	// number of lines taken by help below, adjust accordingly!
	HelpRows = 0
)

Functions

func CellController added in v1.5.1

func CellController(input table.StyledCellFuncInput, m FilterTable) lipgloss.Style

Applied to every cell on every change (TAB,up,down key, resize event etc)

func Exists added in v1.2.0

func Exists[K comparable, V any](m map[K]V, v K) bool

generic map.Exists(key)

func FilterByPattern added in v1.2.0

func FilterByPattern(conf cfg.Config, input io.Reader) (io.Reader, error)

* Filters the whole input lines, returns filtered lines

func Pager added in v1.5.0

func Pager(title, message string)

func PrepareColumnVars added in v1.3.0

func PrepareColumnVars(columns string, data *Tabdata) ([]int, error)

func PrepareColumns

func PrepareColumns(conf *cfg.Config, data *Tabdata) error

parse columns list given with -c, modifies config.UseColumns based on eventually given regex. This is an output filter, because -cN,N,... is being applied AFTER processing of the input data.

func PrepareSortColumns added in v1.3.1

func PrepareSortColumns(conf *cfg.Config, data *Tabdata) error

output option, prepare -k1,2 sort fields

func PrepareTransposerColumns added in v1.3.0

func PrepareTransposerColumns(conf *cfg.Config, data *Tabdata) error

Same thing as above but for -T option, which is an input option, because transposers are being applied before output.

func ProcessFiles

func ProcessFiles(conf *cfg.Config, args []string) error

func SetHeaders added in v1.5.10

func SetHeaders(conf cfg.Config, headers []string) []string

* Setup headers, given headers might be usable headers or just the * first row, which we use to determine how many headers to generate, * if enabled.

func ValidateConsistency added in v1.2.2

func ValidateConsistency(data *Tabdata) error

validate the consitency of parsed data

Types

type Context added in v1.5.1

type Context struct {
	// contains filtered or unexported fields
}

The context exists outside of the bubble loop, and is being used as pointer reciever. That way we can use it as our primary storage container.

func (*Context) Sort added in v1.5.1

func (ctx *Context) Sort(mode string)

Execute tablizer sort function, feed it with fresh config, we do NOT use the existing runtime config, because sorting is configurable in the UI separately.

type Doc added in v1.5.0

type Doc struct {
	// contains filtered or unexported fields
}

func (Doc) Init added in v1.5.0

func (m Doc) Init() tea.Cmd

func (Doc) Update added in v1.5.0

func (m Doc) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Doc) View added in v1.5.0

func (m Doc) View() string

type FilterTable added in v1.5.0

type FilterTable struct {
	Table table.Model

	Rows int
	// contains filtered or unexported fields
}

The actual table model, holds the context pointer, a copy of the pre-processed data and some flags

func NewModel added in v1.5.0

func NewModel(data *Tabdata, ctx *Context) FilterTable

initializes the table model

func (FilterTable) Init added in v1.5.0

func (m FilterTable) Init() tea.Cmd

func (*FilterTable) SelectNextColumn added in v1.5.1

func (m *FilterTable) SelectNextColumn()

User hit the TAB key

func (*FilterTable) Sort added in v1.5.1

func (m *FilterTable) Sort(mode string)

Forward call to context sort

func (*FilterTable) ToggleAllSelected added in v1.5.1

func (m *FilterTable) ToggleAllSelected()

Selects or deselects ALL rows

func (FilterTable) ToggleHelp added in v1.5.1

func (m FilterTable) ToggleHelp()

? pressed, display help message

func (FilterTable) Update added in v1.5.0

func (m FilterTable) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Part of the bubbletea event loop, called every tick

func (FilterTable) View added in v1.5.0

func (m FilterTable) View() string

Part of the bubbletable event view, called every tick

type HelpColumn added in v1.5.1

type HelpColumn []HelpLine

type HelpLine added in v1.5.1

type HelpLine []string

type Tabdata

type Tabdata struct {
	// contains filtered or unexported fields
}

contains a whole parsed table

func FilterByFields added in v1.2.0

func FilterByFields(conf cfg.Config, data *Tabdata) (*Tabdata, bool, error)

* Filter parsed data by fields. The filter is positive, so if one or * more filters match on a row, it will be kept, otherwise it will be * excluded.

func Parse added in v1.0.12

func Parse(conf cfg.Config, input io.Reader) (Tabdata, error)

Parser switch

func PostProcess added in v1.3.0

func PostProcess(conf cfg.Config, data *Tabdata) (*Tabdata, bool, error)

func TransposeFields added in v1.3.0

func TransposeFields(conf cfg.Config, data *Tabdata) (*Tabdata, bool, error)

* Transpose fields using search/replace regexp.

func (*Tabdata) CloneEmpty added in v1.2.0

func (data *Tabdata) CloneEmpty() Tabdata

Jump to

Keyboard shortcuts

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