search

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderInput

func RenderInput(m Model) (string, string)

RenderInput renders the input view.

func RenderSelection

func RenderSelection(m Model) string

RenderSelection renders the selection menu.

func SearchCommand

func SearchCommand() error

func UpdateInput

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

UpdateInput handles text input updates.

func UpdateSelection

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

UpdateSelection handles navigation in the selection menu.

Types

type Model

type Model struct {
	Choice         int             // Index of the selected search category (e.g., 0 = Pokémon, 1 = Ability)
	Chosen         bool            // Whether a category has been chosen yet
	Quitting       bool            // Flag to indicate if the program is quitting
	TextInput      textinput.Model // The text input field used for search input
	ShowResults    bool            // Whether to display the search results screen
	SearchResults  string          // The formatted search results to be displayed
	WarningMessage string          // A warning message to show (e.g., empty input)
}

Model structure

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the program.

func (Model) Update

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

Update handles keypresses and updates the state.

func (Model) View

func (m Model) View() string

View renders the correct UI screen.

type Resource

type Resource struct {
	Count    int         `json:"count"`
	Next     string      `json:"next"`
	Previous interface{} `json:"previous"`
	Results  []Result    `json:"results"`
}

type Result

type Result struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

Result is a resources list result.

Jump to

Keyboard shortcuts

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