table

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Package table provides a shell script interface for the table bubble. https://github.com/charmbracelet/bubbles/tree/master/table

It is useful to render tabular (CSV) data in a terminal and allows the user to select a row from the table.

Let's render a table of gum flavors:

$ gum table <<< "Flavor,Price\nStrawberry,$0.50\nBanana,$0.99\nCherry,$0.75"

Flavor      Price
Strawberry  $0.50
Banana      $0.99
Cherry      $0.75

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Separator       string   `short:"s" help:"Row separator" default:","`
	Columns         []string `short:"c" help:"Column names"`
	Widths          []int    `short:"w" help:"Column widths"`
	Height          int      `help:"Table height" default:"0"`
	Print           bool     `short:"p" help:"static print" default:"false"`
	File            string   `short:"f" help:"file path" default:""`
	Border          string   `short:"b" help:"border style" default:"rounded" enum:"rounded,thick,normal,hidden,double,none"`
	ShowHelp        bool     `help:"Show help keybinds" default:"true" negatable:"" env:"GUM_TABLE_SHOW_HELP"`
	LazyQuotes      bool     `` /* 166-byte string literal not displayed */
	FieldsPerRecord int      `help:"Sets the number of expected fields per record" default:"0" env:"GUM_TABLE_FIELDS_PER_RECORD"`

	BorderStyle   style.Styles  `embed:"" prefix:"border." envprefix:"GUM_TABLE_BORDER_"`
	CellStyle     style.Styles  `embed:"" prefix:"cell." envprefix:"GUM_TABLE_CELL_"`
	HeaderStyle   style.Styles  `embed:"" prefix:"header." envprefix:"GUM_TABLE_HEADER_"`
	SelectedStyle style.Styles  `embed:"" prefix:"selected." set:"defaultForeground=212" envprefix:"GUM_TABLE_SELECTED_"`
	ReturnColumn  int           `` /* 127-byte string literal not displayed */
	Timeout       time.Duration `help:"Timeout until choose returns selected element" default:"0s" env:"GUM_TABLE_TIMEOUT"`
}

Options is the customization options for the table command.

func (Options) Run

func (o Options) Run() error

Run provides a shell script interface for rendering tabular data (CSV).

Jump to

Keyboard shortcuts

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