commands

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ListKeyMap = ListKeyMapT{
	Open: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "open"),
	),
	Favourite: key.NewBinding(
		key.WithKeys("f"),
		key.WithHelp("f", "favourite"),
	),
	ToggleFavourites: key.NewBinding(
		key.WithKeys("F"),
		key.WithHelp("F", "toggle show favourite"),
	),
	Read: key.NewBinding(
		key.WithKeys("m"),
		key.WithHelp("m", "mark read"),
	),
	ToggleReads: key.NewBinding(
		key.WithKeys("M"),
		key.WithHelp("M", "toggle show read"),
	),
	Refresh: key.NewBinding(
		key.WithKeys("r"),
		key.WithHelp("r", "refresh"),
	),
	OpenInBrowser: key.NewBinding(
		key.WithKeys("o"),
		key.WithHelp("o", "open in browser"),
	),
	// contains filtered or unexported fields
}

ListKeyMap shows either (o)verrides or new keybinds

View Source
var ViewportKeyMap = ViewportKeyMapT{
	Next: key.NewBinding(
		key.WithKeys("l", "right"),
		key.WithHelp("l/→", "next"),
	),
	Prev: key.NewBinding(
		key.WithKeys("h", "left"),
		key.WithHelp("h/←", "prev"),
	),
	Quit: key.NewBinding(
		key.WithKeys("ctrl+c"),
		key.WithHelp("ctrl+c", "quit"),
	),
	Escape: key.NewBinding(
		key.WithKeys("esc", "q"),
		key.WithHelp("q/esc", "escape"),
	),
	OpenInBrowser: key.NewBinding(
		key.WithKeys("o"),
		key.WithHelp("o", "open in browser"),
	),
	GotoStart: key.NewBinding(
		key.WithKeys("g", "home"),
		key.WithHelp("g", "top"),
	),
	GotoEnd: key.NewBinding(
		key.WithKeys("G", "end"),
		key.WithHelp("G", "bottom"),
	),
	ShowFullHelp: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "more"),
	),
	CloseFullHelp: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "close help"),
	),
}

ViewportKeyMapT shows *all* keybinds, pulling from viewport.DefaultKeyMap()

Functions

func CustomFilter added in v2.2.0

func CustomFilter(term string, targets []string) []list.Rank

func GetWslHostName

func GetWslHostName() string

Gets the subsystem host ip If the CLI is running under WSL the localhost url will not work so this function should return the real ip that we should redirect to

func IsWSL

func IsWSL() bool

func IsWayland

func IsWayland() bool

func Render

func Render(items []list.Item, cmds Commands, errors []string) error

Types

type Commands

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

func New

func New(config config.Config, store store.Store) Commands

func (Commands) Add

func (c Commands) Add(url string) error

func (Commands) CleanFeeds

func (c Commands) CleanFeeds() error

func (Commands) FindArticle

func (c Commands) FindArticle(substr string) (item store.Item, err error)

func (Commands) GetAllFeeds

func (c Commands) GetAllFeeds() ([]store.Item, error)

func (Commands) GetArticleByID

func (c Commands) GetArticleByID(ID int) (store.Item, error)

func (Commands) GetGlamourisedArticle

func (c Commands) GetGlamourisedArticle(ID int) (string, error)

func (Commands) List

func (c Commands) List(numResults int) error

func (Commands) OpenInBrowser

func (c Commands) OpenInBrowser(url string) error
func (c Commands) OpenLink(url string) error

func (Commands) TUI

func (c Commands) TUI() error

type ErrorItem added in v2.1.4

type ErrorItem struct {
	FeedURL string
	Err     error
}

type FetchResultError

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

type Filterer added in v2.2.0

type Filterer struct {
	FeedNames []string
	Term      struct {
		Title     string
		FeedNames []string
	}
}

Struct to aid in filtering items into ranks for BubbleTea

func NewFilterer added in v2.2.0

func NewFilterer(term string) Filterer

func (*Filterer) ExtractFiltersFor added in v2.2.0

func (f *Filterer) ExtractFiltersFor(tags ...string) []string

Extracts `tag:.*` from the stored f.Term.Title

func (*Filterer) Filter added in v2.2.0

func (f *Filterer) Filter(targets []string) []fuzzy.Match

Runs all filters

func (*Filterer) FilterBy added in v2.2.0

func (f *Filterer) FilterBy(filterValues []string, targetFilterValues []string, ranks []fuzzy.Match) []fuzzy.Match

Filters by specific filterValue/s on the Filterer.Term

func (*Filterer) GetItem added in v2.2.0

func (f *Filterer) GetItem(filterValue string) TUIItem

Breaks what's returned from TUIItem.FilterValue() into a TUIItem.

type ListKeyMapT added in v2.2.2

type ListKeyMapT struct {
	Open             key.Binding
	Read             key.Binding
	Favourite        key.Binding
	ToggleReads      key.Binding
	ToggleFavourites key.Binding
	Refresh          key.Binding
	OpenInBrowser    key.Binding
	// contains filtered or unexported fields
}

ListKeyMapT shows either (o)verrides or new keybinds

func (ListKeyMapT) FullHelp added in v2.2.2

func (k ListKeyMapT) FullHelp() []key.Binding

This shows *additional* (or overridden) keybinds alongside built-ins, which *must* take []key.Binding unfortunately.

func (ListKeyMapT) SetOverrides added in v2.2.2

func (k ListKeyMapT) SetOverrides(l *list.Model)

func (ListKeyMapT) ShortHelp added in v2.2.2

func (k ListKeyMapT) ShortHelp() []key.Binding

This shows *additional* (or overridden) keybinds alongside built-ins

type TUIItem

type TUIItem struct {
	ID        int
	Title     string
	FeedName  string
	URL       string
	Read      bool
	Favourite bool
}

func ItemToTUIItem

func ItemToTUIItem(i store.Item) TUIItem

func (TUIItem) FilterValue

func (i TUIItem) FilterValue() string

type ViewportKeyMapT added in v2.2.2

type ViewportKeyMapT struct {
	Quit          key.Binding
	Escape        key.Binding
	OpenInBrowser key.Binding
	GotoStart     key.Binding
	GotoEnd       key.Binding
	Next          key.Binding
	Prev          key.Binding
	ShowFullHelp  key.Binding
	CloseFullHelp key.Binding
}

ViewportKeyMapT shows *all* keybinds, pulling from viewport.DefaultKeyMap()

func (ViewportKeyMapT) FullHelp added in v2.2.2

func (k ViewportKeyMapT) FullHelp() [][]key.Binding

This show *all* keybinds, as bubbles/viewport doesn't provide a help function

func (ViewportKeyMapT) ShortHelp added in v2.2.2

func (k ViewportKeyMapT) ShortHelp() []key.Binding

This show *all* keybinds, as bubbles/viewport doesn't provide a help function

Jump to

Keyboard shortcuts

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