config

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Todo: check error
	HomePath, _      = utils.Home()
	LazykubeHomePath = path.Join(HomePath, ".lazykube/")

	Conf = &Config{}

	DefaultConfig = &Config{
		GuiConfig: &GuiConfig{
			Highlight:  true,
			Cursor:     false,
			FgColor:    gocui.ColorWhite,
			SelFgColor: gocui.ColorGreen,
			Mouse:      true,
			InputEsc:   true,
		},
		LogConfig: &LogConfig{
			Path:  path.Join(LazykubeHomePath, "log/"),
			Level: logrus.InfoLevel,
		},
		UserConfig: &UserConfig{
			CustomResourcePanels: []string{},
			History: &History{
				ImageHistory:   []string{},
				CommandHistory: []string{},
			},
		},
	}
)

Functions

func Read added in v0.8.0

func Read()

func Save added in v0.8.0

func Save()

Types

type Config added in v0.8.0

type Config struct {
	GuiConfig  *GuiConfig  `yaml:"gui_config"`
	LogConfig  *LogConfig  `yaml:"log_config"`
	UserConfig *UserConfig `yaml:"user_config"`
}

func (*Config) ReadFrom added in v0.8.0

func (c *Config) ReadFrom(filePath, fileName string) error

ReadFrom read config

func (*Config) SaveTo added in v0.8.0

func (c *Config) SaveTo(filePath, fileName string) error

SaveTo save config

type GuiConfig

type GuiConfig struct {
	Highlight  bool            `yaml:"highlight"`
	Cursor     bool            `yaml:"cursor"`
	FgColor    gocui.Attribute `yaml:"fg_color"`
	BgColor    gocui.Attribute `yaml:"bg_color"`
	SelBgColor gocui.Attribute `yaml:"sel_bg_color"`
	SelFgColor gocui.Attribute `yaml:"sel_fg_color"`
	Mouse      bool            `yaml:"mouse"`
	InputEsc   bool            `yaml:"input_esc"`
}

GuiConfig GuiConfig

type History added in v0.8.0

type History struct {
	ImageHistory   []string `yaml:"image_history"`
	CommandHistory []string `yaml:"command_history"`
	PodNameHistory []string `yaml:"pod_name_history"`
}

func (*History) AddCommandHistory added in v0.8.0

func (h *History) AddCommandHistory(newOne string)

func (*History) AddImageHistory added in v0.8.0

func (h *History) AddImageHistory(newOne string)

func (*History) AddPodNameHistory added in v0.8.0

func (h *History) AddPodNameHistory(newOne string)

func (*History) AddStringHistory added in v0.8.0

func (h *History) AddStringHistory(history []string, newOne string) []string

type LogConfig added in v0.8.0

type LogConfig struct {
	Path  string       `yaml:"path"`
	Level logrus.Level `yaml:"level"`
}

type UserConfig added in v0.8.0

type UserConfig struct {
	CustomResourcePanels []string
	History              *History `yaml:"history"`
}

func (*UserConfig) AddCustomResourcePanels added in v0.8.0

func (c *UserConfig) AddCustomResourcePanels(resources ...string)

func (*UserConfig) DeleteCustomResourcePanels added in v0.8.0

func (c *UserConfig) DeleteCustomResourcePanels(resources ...string)

Jump to

Keyboard shortcuts

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