config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEntry added in v0.3.0

func AddEntry(path, binding string, kbIgnorePrefix bool) error

func CreateDefaultConfigFile

func CreateDefaultConfigFile() error

Create default config file if does not exist

func GetBaseDir

func GetBaseDir() (string, error)

func GetorCreateConfigDir

func GetorCreateConfigDir(baseDir string) (string, error)

func Parse

func Parse(flagKPath, cfgPath string) (Apps, *Config, error)

Types

type App

type App struct {
	Name     string    `yaml:"name"`
	Prefix   string    `yaml:"prefix,omitempty"`
	Keybinds []KeyBind `yaml:"keybinds"`
}

func (App) String added in v0.3.0

func (a App) String() string

type Apps

type Apps []*App

func ParseApps

func ParseApps(path string) (Apps, error)

type Color

type Color struct {
	PromptColor   string `yaml:"prompt"`
	CursorFg      string `yaml:"cursor_fg"`
	CursorBg      string `yaml:"cursor_bg"`
	FilterFg      string `yaml:"filter_fg"`
	FilterBg      string `yaml:"filter_bg"`
	CounterFg     string `yaml:"counter_fg"`
	CounterBg     string `yaml:"counter_bg"`
	PlaceholderFg string `yaml:"placeholder_fg"`
	PlaceholderBg string `yaml:"placeholder_bg"`
	BorderColor   string `yaml:"border_color"`
}

type Config

type Config struct {
	Settings `yaml:"settings"`
	Color    `yaml:"color"`
	Keys     `yaml:"keys"`
}

func ParseConfig

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

type KeyBind

type KeyBind struct {
	Name string `yaml:"name"`
	Key  string `yaml:"key"`

	// ignore prefix defaults to false
	// so user can choose to ignore prefix for a specific kb
	IgnorePrefix bool `yaml:"ignore_prefix,omitempty"`
}

type Keys added in v0.2.0

type Keys struct {
	Quit          string
	Up            string
	Down          string
	UpFocus       string `yaml:"up_focus"`
	DownFocus     string `yaml:"down_focus"`
	HalfUp        string `yaml:"half_up"`
	HalfDown      string `yaml:"half_down"`
	FullUp        string `yaml:"full_up"`
	FullDown      string `yaml:"full_bottom"`
	GoToFirstLine string `yaml:"first_line"`
	GoToLastLine  string `yaml:"last_line"`
	GoToTop       string `yaml:"top"`
	GoToMiddle    string `yaml:"middle"`
	GoToBottom    string `yaml:"bottom"`
	Search        string
	ClearSearch   string `yaml:"clear_search"`
	Normal        string
}

type Settings

type Settings struct {
	KeybPath       string `yaml:"keyb_path"`
	Debug          bool
	Reverse        bool
	Mouse          bool
	SearchMode     bool `yaml:"search_mode"`
	SortKeys       bool `yaml:"sort_keys"`
	Title          string
	Prompt         string
	PromptLocation string `yaml:"prompt_location"`
	Placeholder    string
	PrefixSep      string `yaml:"prefix_sep"`
	SepWidth       int    `yaml:"sep_width"`
	Margin         int
	Padding        int
	BorderStyle    string `yaml:"border"`
}

Jump to

Keyboard shortcuts

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