app

package
v0.0.0-...-ab8143e Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BS  = 1 // Border size.
	THH = 3 // Height of the table header, with borders.
	TFH = 3 // Height of the table footer, with borders.
	FHH = 7 // Height of the full help menu, with borders.
	SHH = 3 // Height of the short help menu, with borders.
)

A few size constants.

View Source
const (
	C0 = "#000000"
	C1 = "#DF2E2E"
	C2 = "#FFF7AE"
	C3 = "#3C3C3C"
)

Color scheme.

Variables

View Source
var (
	KoshkaStyle = lip.NewStyle().Padding(1, 2, 1, 2)

	TitleStyle = lip.NewStyle().
				Bold(true).
				Padding(0, 1).
				Margin(1, 1, 1, 1).
				Foreground(lip.Color(C2)).
				Background(lip.Color(C1))

	DescStyle = lip.NewStyle().
				Italic(true).
				Margin(0, 0, 1, 0).
				Padding(0, 1, 0, 2).
				Foreground(lip.Color(C2))

	SearchBarStyle = lip.NewStyle().
					BorderStyle(lip.RoundedBorder()).
					BorderForeground(lip.Color(C2))

	SearchTextStyle   = lip.NewStyle()
	SearchPromptStyle = lip.NewStyle()
	SearchCursorStyle = lip.NewStyle()
	ActiveDotStyle    = lip.NewStyle()
	InactiveDotStyle  = lip.NewStyle()
	SpinnerStyle      = lip.NewStyle()

	ConsoleStyle = lip.NewStyle().
					Foreground(lip.Color(C2)).
					BorderForeground(lip.Color(C2)).
					BorderStyle(lip.RoundedBorder())

	TableStyle = lip.NewStyle().
				Foreground(lip.Color(C2)).
				BorderForeground(lip.Color(C2))

	TableColumnStyle = lip.NewStyle().
						Bold(true).
						Align(lip.Center).
						Foreground(lip.Color(C2))

	TableRowNormalStyle = lip.NewStyle().
						Foreground(lip.Color(C2))

	TableRowSelectedStyle = lip.NewStyle().
							Bold(true).
							Background(lip.Color(C1)).
							Foreground(lip.Color(C2))

	TableFooterStyle = lip.NewStyle().
						Bold(true).
						Foreground(lip.Color(C2))

	HelpStyle = lip.NewStyle().
				BorderStyle(lip.RoundedBorder()).
				BorderForeground(lip.Color(C3))

	CommentsStyle = lip.NewStyle().
					Foreground(lip.Color(C2)).
					BorderForeground(lip.Color(C2)).
					BorderStyle(lip.RoundedBorder()).
					SetString(
			"P: Period, in seconds.\n" +
				"DM: Dispersion Measure, in pc per cm³\n" +
				"P1: Period derivative; dimensionless.\n" +
				"GL/GB: Galactic coordinates, in degrees.")

	MoodyBarStyle = lip.NewStyle().
					Foreground(lip.Color(C0)).
					Background(lip.Color(C2))

	MoodyStyle = lip.NewStyle().
				Inherit(MoodyBarStyle).
				Italic(true).
				Padding(0, 1).
				Align(lip.Center)
)

Functions

func AllData

func AllData() []table.Row

func ApplySearch

func ApplySearch(C *Cat) tea.Cmd

func CreateEmptyTable

func CreateEmptyTable() table.Model

func CreateFilledTable

func CreateFilledTable() table.Model

func CreateFinder

func CreateFinder() textinput.Model

func DataIntoTable

func DataIntoTable(search string) []table.Row

func SaveSearch

func SaveSearch(C *Cat)

func TheCatMeows

func TheCatMeows()

Run the application.

Types

type Cat

type Cat struct {
	W int
	H int

	Name    string
	Author  string
	Website string

	Mood   Mood
	Paws   Paws
	Help   help.Model
	Table  table.Model
	Finder textinput.Model
}

The application model.

func Кошка

func Кошка() Cat

The default application state.

func (*Cat) BrowseMood

func (C *Cat) BrowseMood(msg tea.Msg) tea.Cmd

func (Cat) CommentsView

func (C Cat) CommentsView() string

func (Cat) FinderView

func (C Cat) FinderView() string

func (Cat) HelpView

func (C Cat) HelpView() string

func (Cat) Init

func (C Cat) Init() tea.Cmd

func (Cat) MoodyBar

func (C Cat) MoodyBar() string

func (*Cat) MoodyPaws

func (C *Cat) MoodyPaws()

func (*Cat) SearchMood

func (C *Cat) SearchMood(msg tea.Msg) tea.Cmd

func (Cat) TableView

func (C Cat) TableView() string

func (Cat) TitleBar

func (C Cat) TitleBar() string

func (Cat) Update

func (C Cat) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Cat) UpdateFooter

func (C *Cat) UpdateFooter()

func (*Cat) UpdateTable

func (C *Cat) UpdateTable(Msg SearchMsg)

func (Cat) View

func (C Cat) View() string

type Mood

type Mood int
const (
	Browsing  Mood = 0
	Searching Mood = 1
)

func (Mood) String

func (M Mood) String() string

type Paws

type Paws struct {
	Quit            key.Binding
	ForceQuit       key.Binding
	RowUp           key.Binding
	RowDown         key.Binding
	NextPage        key.Binding
	PrevPage        key.Binding
	Search          key.Binding
	ClearSearch     key.Binding
	ToggleFullHelp  key.Binding
	CancelSearching key.Binding
	SaveSearchData  key.Binding
}

func CreatePaws

func CreatePaws() Paws

func (Paws) FullHelp

func (P Paws) FullHelp() [][]key.Binding

func (Paws) ShortHelp

func (P Paws) ShortHelp() []key.Binding

type SearchMsg

type SearchMsg []table.Row

Jump to

Keyboard shortcuts

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