tui

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(opts Options) error

func ParseRefreshInterval

func ParseRefreshInterval(s string) time.Duration

Types

type App

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

func NewApp

func NewApp(opts Options) *App

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 FilterState

type FilterState struct {
	Symbol     string
	ShowFilter bool
}

type KeyMsg

type KeyMsg tea.KeyMsg

type Msg

type Msg tea.Msg

type Options

type Options struct {
	Section         string
	Provider        string
	Market          string
	Symbol          string
	RefreshInterval string
}

type ProviderWrapper

type ProviderWrapper interface {
	GetProviderForFeature(ctx context.Context, feature capability.Feature, providerID string, market model.MarketType) (provider.Provider, model.MarketType, error)
	GetAvailableProviders(feature capability.Feature) []string
	GetAvailableMarkets(providerID string, feature capability.Feature) []model.MarketType
}

type RefreshConfig

type RefreshConfig struct {
	Interval   time.Duration
	Enabled    bool
	LastUpdate time.Time
	TickCmd    chan time.Time
}

type Section

type Section string
const (
	SectionPrices   Section = "prices"
	SectionTicker   Section = "ticker"
	SectionExchange Section = "exchange"
	SectionBook     Section = "book"
	SectionCandles  Section = "candles"
	SectionMarkets  Section = "markets"
	SectionTrending Section = "trending"
)

func (Section) Feature

func (s Section) Feature() string

type SectionModel

type SectionModel interface {
	Init() tea.Cmd
	Update(msg tea.Msg) (tea.Model, tea.Cmd)
	View() string
}

type SectionWithProvider

type SectionWithProvider interface {
	SectionModel
	ProviderID() string
	Market() model.MarketType
	Cursor() int
	Loading() bool
	Error() error
}

type TUIProvider

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

func NewTUIProvider

func NewTUIProvider() (*TUIProvider, error)

func (*TUIProvider) Config

func (tp *TUIProvider) Config() *config.Config

func (*TUIProvider) GetAvailableMarkets

func (tp *TUIProvider) GetAvailableMarkets(providerID string, feature capability.Feature) []model.MarketType

func (*TUIProvider) GetAvailableProviders

func (tp *TUIProvider) GetAvailableProviders(feature capability.Feature) []string

func (*TUIProvider) GetProviderForFeature

func (tp *TUIProvider) GetProviderForFeature(
	ctx context.Context,
	feature capability.Feature,
	providerID string,
	market model.MarketType,
) (provider.Provider, model.MarketType, error)

func (*TUIProvider) ID

func (tp *TUIProvider) ID() string

type TUIState

type TUIState struct {
	Section   Section
	Provider  string
	Market    model.MarketType
	Filters   FilterState
	Providers []string
	Markets   []model.MarketType
	MultiMode bool
	Refresh   RefreshConfig
	Error     error
}

func NewTUIState

func NewTUIState(opts Options) *TUIState

type WindowSizeMsg

type WindowSizeMsg tea.WindowSizeMsg

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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