csv

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package csv implements a csv bubble which renders a table with the content of the csv.

Index

Constants

This section is empty.

Variables

View Source
var (
	HeaderStyle  = lipgloss.NewStyle().Foreground(purple).Bold(true).Align(lipgloss.Center)
	CellStyle    = lipgloss.NewStyle().Padding(0, 1).Width(14)
	OddRowStyle  = CellStyle.Copy().Foreground(gray)
	EvenRowStyle = CellStyle.Copy().Foreground(lightGray)
)

Functions

This section is empty.

Types

type Model

type Model struct {
	Viewport              viewport.Model
	Filename              string
	Table                 *table.Table
	StatusMessage         string
	StatusMessageLifetime time.Duration

	ViewportDisabled bool
	Headers          []string
	Records          [][]string
	// contains filtered or unexported fields
}

Model represents the properties of a code bubble.

func New

func New() Model

New creates a new instance of code.

func (*Model) GotoBottom

func (m *Model) GotoBottom()

GotoBottom jumps to the bottom of the viewport.

func (*Model) GotoTop

func (m *Model) GotoTop()

GotoTop jumps to the top of the viewport.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the code bubble.

func (*Model) NewStatusMessageCmd

func (m *Model) NewStatusMessageCmd(s string) tea.Cmd

NewStatusMessage sets a new status message, which will show for a limited amount of time.

func (*Model) SetFileNameCmd

func (m *Model) SetFileNameCmd(filename string) tea.Cmd

SetFileName sets current file to highlight.

func (*Model) SetSizeCmd

func (m *Model) SetSizeCmd(w, h int) tea.Cmd

SetSize sets the size of the bubble.

func (*Model) SetViewportDisabled

func (m *Model) SetViewportDisabled(disabled bool)

SetViewportDisabled toggles the state of the viewport.

func (Model) Update

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

Update handles updating the UI of the code bubble.

func (Model) View

func (m Model) View() string

View returns a string representation of the csv bubble.

Jump to

Keyboard shortcuts

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