config

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFeedAlreadyExists  = errors.New("config.AddFeed: feed already exists")
	DefaultConfigDirName  = "nom"
	DefaultConfigFileName = "config.yml"
	DefaultDatabaseName   = "nom.db"
)
View Source
var DefaultTheme = Theme{
	Glamour:           "dark",
	SelectedItemColor: "170",
	TitleColor:        "62",
	TitleColorFg:      "231",
	FilterColor:       "62",
	ReadIcon:          "\u2713",
}

Functions

func TLSVersion added in v2.6.0

func TLSVersion(configStr string) (uint16, error)

TLSVersion maps one of a few supported TLS version strings to the corresponding standard TLS library constant so that an HTTP client can be configured.

Types

type Backends

type Backends struct {
	Miniflux *MinifluxBackend `yaml:"miniflux,omitempty"`
	FreshRSS *FreshRSSBackend `yaml:"freshrss,omitempty"`
}

type Cat added in v2.10.0

type Cat struct {
	Label string `yaml:"label,omitempty"`
}

type Config

type Config struct {
	ConfigPath     string
	ShowFavourites bool `yaml:"showfavourites,omitempty"`
	Version        string
	ConfigDir      string       `yaml:"-"`
	Pager          string       `yaml:"pager,omitempty"`
	Feeds          []Feed       `yaml:"feeds"`
	Database       string       `yaml:"database"`
	Ordering       string       `yaml:"ordering"`
	Filtering      FilterConfig `yaml:"filtering"`
	// Preview feeds are distinguished from Feeds because we don't want to inadvertenly write those into the config file.
	PreviewFeeds    []Feed       `yaml:"previewfeeds,omitempty"`
	Backends        *Backends    `yaml:"backends,omitempty"`
	ShowRead        bool         `yaml:"showread,omitempty"`
	AutoRead        bool         `yaml:"autoread,omitempty"`
	Openers         []Opener     `yaml:"openers,omitempty"`
	Theme           Theme        `yaml:"theme,omitempty"`
	HTTPOptions     *HTTPOptions `yaml:"http,omitempty"`
	RefreshInterval int          `yaml:"refreshinterval,omitempty"`
}

need to add to Load() below if loading from config file

func New

func New(configPath string, pager string, previewFeeds []string, version string) (*Config, error)

func (*Config) AddFeed

func (c *Config) AddFeed(feed Feed) error

func (*Config) GetFeeds

func (c *Config) GetFeeds() []Feed

func (*Config) ImportFeeds added in v2.18.0

func (c *Config) ImportFeeds() ([]Feed, error)

func (*Config) IsPreviewMode

func (c *Config) IsPreviewMode() bool

func (*Config) Load

func (c *Config) Load() error

func (*Config) ToggleShowFavourites added in v2.1.5

func (c *Config) ToggleShowFavourites()

func (*Config) ToggleShowRead

func (c *Config) ToggleShowRead()

func (*Config) Write

func (c *Config) Write() error

Write writes to a config file

type Feed

type Feed struct {
	URL  string `yaml:"url"`
	Name string `yaml:"name,omitempty"`
}

type FilterConfig added in v2.12.0

type FilterConfig struct {
	DefaultIncludeFeedName bool `yaml:"defaultIncludeFeedName"`
}

type FreshRSSBackend

type FreshRSSBackend struct {
	Host       string `yaml:"host"`
	User       string `yaml:"user"`
	Password   string `yaml:"password"`
	PrefixCats bool   `yaml:"prefixCats"`
}

type FreshRSSFeed

type FreshRSSFeed struct {
	URL        string `yaml:"url,omitempty"`
	Categories []Cat  `yaml:"categories,omitempty"`
}

func (FreshRSSFeed) GetCats added in v2.10.0

func (frss FreshRSSFeed) GetCats() string

type FreshRSSResponse

type FreshRSSResponse struct {
	Subscriptions []FreshRSSFeed `yaml:"subscriptions,omitempty"`
}

type HTTPOptions added in v2.6.0

type HTTPOptions struct {
	//MinTLSVersion must be set to one of the strings returned by
	//tls.VersionName. "TLS 1.2" by default.
	MinTLSVersion string `yaml:"mintls,omitempty"`
}

type MinifluxBackend

type MinifluxBackend struct {
	Host   string `yaml:"host"`
	APIKey string `yaml:"api_key"`
}

type Opener added in v2.1.6

type Opener struct {
	Regex    string `yaml:"regex"`
	Cmd      string `yaml:"cmd"`
	Takeover bool   `yaml:"takeover"`
}

type Theme added in v2.4.0

type Theme struct {
	Glamour           string `yaml:"glamour,omitempty"`
	TitleColor        string `yaml:"titleColor,omitempty"`
	TitleColorFg      string `yaml:"titleColorFg,omitempty"`
	FilterColor       string `yaml:"filterColor,omitempty"`
	SelectedItemColor string `yaml:"selectedItemColor,omitempty"`
	ReadIcon          string `yaml:"readIcon,omitempty"`
}

Jump to

Keyboard shortcuts

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