search

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 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() (string, 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
	Chosen         bool
	Quitting       bool
	TextInput      textinput.Model
	ShowResults    bool
	SearchResults  string
	WarningMessage string
}

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