config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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"`
}

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"`
	BorderColor string `yaml:"border_color"`
}

type Config

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

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 Settings

type Settings struct {
	KeybPath    string `yaml:"keyb_path"`
	Debug       bool
	Reverse     bool
	Mouse       bool
	Title       string
	Prompt      string
	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