Documentation
¶
Index ¶
- Constants
- Variables
- func CellController(input table.StyledCellFuncInput, m FilterTable) lipgloss.Style
- func Exists[K comparable, V any](m map[K]V, v K) bool
- func FilterByPattern(conf cfg.Config, input io.Reader) (io.Reader, error)
- func Pager(title, message string)
- func PrepareColumnVars(columns string, data *Tabdata) ([]int, error)
- func PrepareColumns(conf *cfg.Config, data *Tabdata) error
- func PrepareSortColumns(conf *cfg.Config, data *Tabdata) error
- func PrepareTransposerColumns(conf *cfg.Config, data *Tabdata) error
- func ProcessFiles(conf *cfg.Config, args []string) error
- func SetHeaders(conf cfg.Config, headers []string) []string
- func ValidateConsistency(data *Tabdata) error
- type Context
- type Doc
- type FilterTable
- type HelpColumn
- type HelpLine
- type Tabdata
Constants ¶
const ( // header+footer ExtraRows = 5 )
const RWRR = 0755
Variables ¶
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
* Filters the whole input lines, returns filtered lines
func PrepareColumnVars ¶ added in v1.3.0
func PrepareColumns ¶
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
output option, prepare -k1,2 sort fields
func PrepareTransposerColumns ¶ added in v1.3.0
Same thing as above but for -T option, which is an input option, because transposers are being applied before output.
func SetHeaders ¶ added in v1.5.10
* 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
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.
type FilterTable ¶ added in v1.5.0
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) 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 Tabdata ¶
type Tabdata struct {
// contains filtered or unexported fields
}
contains a whole parsed table
func FilterByFields ¶ added in v1.2.0
* 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 PostProcess ¶ added in v1.3.0
func TransposeFields ¶ added in v1.3.0
* Transpose fields using search/replace regexp.