tui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProgressDots

func ProgressDots(current, total int) string

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the root bubbletea model.

func NewApp

func NewApp(opts AppOpts) App

NewApp creates the root app model.

func (App) Init

func (a App) Init() tea.Cmd

func (App) Update

func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (App) View

func (a App) View() string

type AppOpts

type AppOpts struct {
	NeedWizard bool
	Config     config.Config
	Sources    map[string]source.Source
	Query      string
	Source     string
	Count      int
	Downloader *download.Downloader
}

AppOpts holds startup configuration.

type DownloadProgressMsg

type DownloadProgressMsg struct {
	Index int
	Path  string
	Err   error
}

DownloadProgressMsg is sent as each item finishes.

type DownloadRecord

type DownloadRecord struct {
	Result     source.WallpaperResult
	Downloaded bool
	Skipped    bool
	Error      string
	Path       string
}

DownloadRecord tracks the outcome of a single wallpaper.

type SearchDoneMsg

type SearchDoneMsg struct {
	Result SearchResult
}

SearchDoneMsg is emitted when the form is submitted.

type SearchModel

type SearchModel struct {
	// contains filtered or unexported fields
}

SearchModel is the multi-step search form.

func NewSearchModel

func NewSearchModel(defaultSource string, count int) SearchModel

func (SearchModel) Done

func (m SearchModel) Done() bool

func (SearchModel) Init

func (m SearchModel) Init() tea.Cmd

func (SearchModel) Result

func (m SearchModel) Result() SearchResult

func (*SearchModel) SetSources

func (m *SearchModel) SetSources(s map[string]source.Source)

SetSources gives the model access to sources for total fetching.

func (SearchModel) Update

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

func (SearchModel) View

func (m SearchModel) View() string

type SearchResult

type SearchResult struct {
	Source    string
	Query     string
	Sort      string
	Count     int
	MinRes    string
	Colors    []string
	Subreddit string
}

SearchResult carries choices from the search form.

type StartDownloadMsg

type StartDownloadMsg struct {
	Index  int
	Result source.WallpaperResult
}

StartDownloadMsg triggers download of a single result.

type SummaryModel

type SummaryModel struct {
	// contains filtered or unexported fields
}

SummaryModel displays a final report.

func NewSummaryModel

func NewSummaryModel(records []DownloadRecord, dir string) SummaryModel

func (SummaryModel) Counts

func (m SummaryModel) Counts() (int, int, int)

func (SummaryModel) Init

func (m SummaryModel) Init() tea.Cmd

func (SummaryModel) Update

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

func (SummaryModel) View

func (m SummaryModel) View() string

type SwipeDoneMsg

type SwipeDoneMsg struct {
	Records []DownloadRecord
}

SwipeDoneMsg signals completion of the download view.

type SwipeModel

type SwipeModel struct {
	// contains filtered or unexported fields
}

SwipeModel is the bulk download view with animated progress.

func NewSwipeModel

func NewSwipeModel(results []source.WallpaperResult) SwipeModel

func (SwipeModel) Current

func (m SwipeModel) Current() source.WallpaperResult

func (SwipeModel) Init

func (m SwipeModel) Init() tea.Cmd

Init starts the spinner and kicks off the first download.

func (SwipeModel) Records

func (m SwipeModel) Records() []DownloadRecord

func (SwipeModel) Remaining

func (m SwipeModel) Remaining() []source.WallpaperResult

Remaining returns unprocessed results.

func (SwipeModel) Total

func (m SwipeModel) Total() int

func (SwipeModel) Update

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

func (SwipeModel) View

func (m SwipeModel) View() string

Jump to

Keyboard shortcuts

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