config

package
Version: v0.99.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFile string = "/config.json"

ConfigFile - config file name

Variables

This section is empty.

Functions

func GetPath

func GetPath(app string) (string, error)

GetPath to config dir

func Write

func Write(path string, config *Config) error

Write config to file

Types

type Colors

type Colors struct {
	SidebarBackground   string `json:"sidebar_background,omitempty"`
	SidebarText         string `json:"sidebar_text,omitempty"`
	MainBackground      string `json:"main_background,omitempty"`
	MainText            string `json:"main_text,omitempty"`
	ArticleBackground   string `json:"article_background,omitempty"`
	ArticleText         string `json:"article_text,omitempty"`
	StatusbarBackground string `json:"statusbar_background,omitempty"`
	StatusbarText       string `json:"statusbar_text,omitempty"`
	HotkeybarBackground string `json:"hotkeybar_background,omitempty"`
	HotkeybarText       string `json:"hotkeybar_text,omitempty"`
}

Colors config

type Config

type Config struct {
	Server     string   `json:"server,omitempty"`
	Login      string   `json:"login,omitempty"`
	Password   string   `json:"password,omitempty"`
	Token      string   `json:"token,omitempty"`
	Sort       Sort     `json:"sort,omitempty"`
	Hotkeys    Hotkeys  `json:"hotkeys,omitempty"`
	Colors     Colors   `json:"colors,omitempty"`
	Elements   Elements `json:"elements,omitempty"`
	DateFormat string   `json:"date_format,omitempty"`
}

Config

func New

func New(app, server, login, password, token, sortOrder, sortDirection, dateFormat string) (*Config, error)

New Config instance

func Read

func Read(path string) (*Config, error)

Read config file

type Elements

type Elements struct {
	Sidebar   bool `json:"sidebar,omitempty"`
	Statusbar bool `json:"statusbar,omitempty"`
	Hotkeybar bool `json:"hotkeybar,omitempty"`
}

Elements - list of enabled/disabled TUI elements

type Hotkeys

type Hotkeys struct {
	Up            string `json:'up,omitempty"`
	Down          string `json:"down,omitempty"`
	Top           string `json:"top,omitempty"`
	Bottom        string `json:"bottom,omitempty"`
	Toggle        string `json:"toggle,omitempty"`
	Close         string `json:"close,omitempty"`
	NextArticle   string `json:"next_article,omitempty"`
	OpenInBrowser string `json:"open_in_browser,omitempty"`
}

Hotkeys config

type Sort

type Sort struct {
	Order     string `json:"order,omitempty"`
	Direction string `json:"direction,omitempty"`
}

Sort config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL