tui

package
v0.0.0-...-e929128 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(config Config) error

func TrySendChannel

func TrySendChannel[T any](msg T, ch chan T) bool

TrySendChannel attempts to send a msg to a channel, returning true if successful.

Types

type AppKeyMap

type AppKeyMap struct {
	Quit            key.Binding
	FocusJobs       key.Binding
	FocusDownloads  key.Binding
	FocusDatasets   key.Binding
	FocusPublishers key.Binding
}

AppKeyMap is the all the key.Binding for the AppModel

func DefaultAppKeyMap

func DefaultAppKeyMap() AppKeyMap

DefaultAppKeyMap returns a default set of key bindings for AppModel

func (*AppKeyMap) FullHelp

func (m *AppKeyMap) FullHelp() [][]key.Binding

FullHelp returns bindings to show the full help view. Implements bubble's help.KeyMap interface.

func (AppKeyMap) ShortHelp

func (m AppKeyMap) ShortHelp() []key.Binding

ShortHelp returns bindings to show in the abbreviated help view. It's part of the help.KeyMap interface.

type AppModel

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

func NewAppModel

func NewAppModel(config Config) AppModel

func (AppModel) Init

func (m AppModel) Init() tea.Cmd

Init handles the initialization of an AppModel

func (AppModel) Update

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

Update handles BubbleTea messages for the AppModel This is for starting/stopping/updating generation.

func (AppModel) View

func (m AppModel) View() string

View renders the AppModels's view.

type Config

type Config struct {
	DatabentoApiKey    string
	MaxActiveDownloads int // note that default would be 0, which is no downloads
}

type DatasetsMsg

type DatasetsMsg struct {
	Datasets []string
	Error    error
}

type DatasetsPageModel

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

Datasets page

func NewDatasetsPage

func NewDatasetsPage(config Config) DatasetsPageModel

func (DatasetsPageModel) Init

func (m DatasetsPageModel) Init() tea.Cmd

Init handles the initialization of an DatasetsPageModel

func (DatasetsPageModel) Update

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

Update handles BubbleTea messages for the DatasetsPageModel

func (DatasetsPageModel) View

func (m DatasetsPageModel) View() string

View renders the DatasetsPageModel's view.

type DownloadCompleteMsg

type DownloadCompleteMsg struct {
	Desc  DownloadDesc
	State DownloadState
}

type DownloadDesc

type DownloadDesc struct {
	JobID    string
	Url      string
	Filename string
	FileHash string
	Size     uint64
}

DownloadDesc decribes a specific download

type DownloadItem

type DownloadItem struct {
	Desc          DownloadDesc
	DestFile      string
	CurrentSize   float64
	State         DownloadState
	ContextCancel context.CancelFunc
}

type DownloadManager

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

func NewDownloadManager

func NewDownloadManager(databentoApiKey string, maxActiveDownloads int) *DownloadManager

func (*DownloadManager) CancelDownload

func (dm *DownloadManager) CancelDownload(jobID string, file dbn_hist.BatchFileDesc) bool

func (*DownloadManager) Close

func (dm *DownloadManager) Close()

Close closes the channels and exits the queue

func (*DownloadManager) Counts

func (dm *DownloadManager) Counts() (queued, active, past int)

Counts returns the number of queued, active, and past downloads

func (*DownloadManager) ProgressChannel

func (dm *DownloadManager) ProgressChannel() chan DownloadProgressMsg

func (*DownloadManager) QueueDownload

func (dm *DownloadManager) QueueDownload(jobID string, file dbn_hist.BatchFileDesc) bool

QueueDownload queues a download for the specified job and file.

type DownloadProgressMsg

type DownloadProgressMsg struct {
	Desc        DownloadDesc
	CurrentSize uint64
	State       DownloadState
	Error       error
}

type DownloadProgressWriter

type DownloadProgressWriter struct {
	Desc        DownloadDesc
	CurrentSize uint64
	ProgressCh  chan DownloadProgressMsg
}

DownloadProgressWriter is an io.Writer that reports download progress via a channel An instance is fed to TeeWriter to track the HTTP download progress

func (*DownloadProgressWriter) Write

func (w *DownloadProgressWriter) Write(p []byte) (int, error)

Write implements the io.Writer interface, tracking and reporting bytes read on the channel

type DownloadState

type DownloadState string
const (
	DownloadNone     DownloadState = ""
	DownloadQueued   DownloadState = "queued"
	DownloadActive   DownloadState = "active"
	DownloadComplete DownloadState = "complete"
	DownloadFailed   DownloadState = "failed"
)

type DownloadsPageKeyMap

type DownloadsPageKeyMap struct {
	CursorUp   key.Binding
	CursorDown key.Binding
}

DownloadsPageKeyMap is the all the key.Binding for the DownloadsPageModel

func DefaultDownloadsPageKeyMap

func DefaultDownloadsPageKeyMap() DownloadsPageKeyMap

DefaultDownloadsPageKeyMap returns a default set of key bindings for DownloadsPageModel

func (*DownloadsPageKeyMap) FullHelp

func (m *DownloadsPageKeyMap) FullHelp() [][]key.Binding

FullHelp returns bindings to show the full help view. Implements bubble's help.KeyMap interface.

func (DownloadsPageKeyMap) ShortHelp

func (m DownloadsPageKeyMap) ShortHelp() []key.Binding

ShortHelp returns bindings to show in the abbreviated help view. It's part of the help.KeyMap interface.

type DownloadsPageModel

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

Downloads page

func NewDownloadsPage

func NewDownloadsPage(config Config) DownloadsPageModel

func (DownloadsPageModel) Init

func (m DownloadsPageModel) Init() tea.Cmd

Init handles the initialization of an DownloadsPageModel

func (DownloadsPageModel) Update

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

Update handles BubbleTea messages for the DownloadsPageModel

func (DownloadsPageModel) View

func (m DownloadsPageModel) View() string

View renders the DownloadsPageModel's view.

type FilesMsg

type FilesMsg struct {
	Files []dbn_hist.BatchFileDesc
	Error error
}

type JobsMsg

type JobsMsg struct {
	Jobs  []dbn_hist.BatchJob
	Error error
}

type JobsPageKeyMap

type JobsPageKeyMap struct {
	NextFocus     key.Binding
	Download      key.Binding
	ToggleExpired key.Binding
	ToggleDetails key.Binding
}

JobsPageKeyMap is the all the key.Binding for the JobsPageModel

func DefaultJobsPageKeyMap

func DefaultJobsPageKeyMap() JobsPageKeyMap

DefaultJobsPageKeyMap returns a default set of key bindings for JobsPageModel

func (*JobsPageKeyMap) FullHelp

func (m *JobsPageKeyMap) FullHelp() [][]key.Binding

FullHelp returns bindings to show the full help view. Implements bubble's help.KeyMap interface.

func (JobsPageKeyMap) ShortHelp

func (m JobsPageKeyMap) ShortHelp() []key.Binding

ShortHelp returns bindings to show in the abbreviated help view. It's part of the help.KeyMap interface.

type JobsPageModel

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

Jobs page

func NewJobsPage

func NewJobsPage(config Config) JobsPageModel

func (JobsPageModel) Init

func (m JobsPageModel) Init() tea.Cmd

Init handles the initialization of an JobsPageModel

func (JobsPageModel) Update

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

Update handles BubbleTea messages for the JobsPageModel

func (JobsPageModel) View

func (m JobsPageModel) View() string

View renders the JobsPageModel's view.

type PublishersMsg

type PublishersMsg struct {
	Publishers []dbn_hist.PublisherDetail
	Error      error
}

type PublishersPageModel

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

Publishers page

func NewPublishersPage

func NewPublishersPage(config Config) PublishersPageModel

func (PublishersPageModel) Init

func (m PublishersPageModel) Init() tea.Cmd

Init handles the initialization of an PublishersPageModel

func (PublishersPageModel) Update

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

Update handles BubbleTea messages for the Publishers Page

func (PublishersPageModel) View

func (m PublishersPageModel) View() string

View renders the PublishersPageModel's view.

type QueueDownloadMsg

type QueueDownloadMsg struct {
	JobID string
	Files []dbn_hist.BatchFileDesc
}

type SchemasMsg

type SchemasMsg struct {
	Dataset    string
	Schemas    []string
	HistPrices map[string]float64
	LivePrices map[string]float64
	Error      error
}

Jump to

Keyboard shortcuts

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