config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Debug       bool   `long:"debug" env:"DEBUG" default:"false"`
	Version     string `long:"version" env:"VERSION" default:"unversioned"`
	Commit      string `long:"commit" env:"COMMIT"`
	BuildDate   string `long:"build-date" env:"BUILD_DATE"`
	Name        string `long:"name" env:"NAME" default:"lazygit"`
	BuildSource string `long:"build-source" env:"BUILD_SOURCE" default:""`
	UserConfig  *UserConfig
	ConfigDir   string
}

AppConfig contains the base configuration fields required for lazygit.

func NewAppConfig

func NewAppConfig(name, version, commit, date string, buildSource string, debuggingFlag bool) (*AppConfig, error)

NewAppConfig makes a new app config

func (*AppConfig) ConfigFilename

func (c *AppConfig) ConfigFilename() string

func (*AppConfig) WriteToUserConfig

func (c *AppConfig) WriteToUserConfig(updateConfig func(*UserConfig) error) error

WriteToUserConfig allows you to set a value on the user config to be saved note that if you set a zero-value, it may be ignored e.g. a false or 0 or empty string this is because we are using the omitempty yaml directive so that we don't write a heap of zero values to the user's config.yml

type CommandTemplatesConfig

type CommandTemplatesConfig struct {
	RestartService  string `yaml:"restartService,omitempty"`
	DockerCompose   string `yaml:"dockerCompose,omitempty"`
	StopService     string `yaml:"stopService,omitempty"`
	ServiceLogs     string `yaml:"serviceLogs,omitempty"`
	ViewServiceLogs string `yaml:"viewServiceLogs,omitempty"`
	RebuildService  string `yaml:"rebuildService,omitempty"`

	// ViewContainerLogs is for viewing the container logs in a subprocess. We have this as a separate command in case you want to show all the logs rather than just tail them for the sake of reducing CPU load when in the lazydocker GUI
	ViewContainerLogs        string `yaml:"viewContainerLogs,omitempty"`
	ContainerLogs            string `yaml:"containerLogs,omitempty"`
	ContainerTTYLogs         string `yaml:"containerTTYLogs,omitempty"`
	AllLogs                  string `yaml:"allLogs,omitempty"`
	ViewAllLogs              string `yaml:"viewAlLogs,omitempty"`
	DockerComposeConfig      string `yaml:"dockerComposeConfig,omitempty"`
	CheckDockerComposeConfig string `yaml:"checkDockerComposeConfig,omitempty"`
	ServiceTop               string `yaml:"serviceTop,omitempty"`
}

type CustomCommand

type CustomCommand struct {
	Attach  bool
	Command string
}

type CustomCommands

type CustomCommands struct {
	Containers []CustomCommand `yaml:"containers,omitempty"`
	Services   []CustomCommand `yaml:"services,omitempty"`
}

type GraphConfig

type GraphConfig struct {
	Min      float64 `yaml:"min,omitempty"`
	Max      float64 `yaml:"max,omitempty"`
	Height   int     `yaml:"height,omitempty"`
	Caption  string  `yaml:"caption,omitempty"`
	StatPath string  `yaml:"statPath,omitempty"`
	Color    string  `yaml:"color,omitempty"`
	// MinType and MaxType are each one of "", "static". blank means the min/max of the data set will be used. "static" means the min/max specified will be used
	MinType string `yaml:"minType,omitempty"`
	MaxType string `yaml:"maxType,omitempty"`
}

GraphConfig specifies how to make a graph of recorded container stats

type GuiConfig

type GuiConfig struct {
	ScrollHeight      int         `yaml:"scrollHeight,omitempty"`
	ScrollPastBottom  bool        `yaml:"scrollPastBottom,omitempty"`
	MouseEvents       bool        `yaml:"mouseEvents,omitempty"`
	Theme             ThemeConfig `yaml:"theme,omitempty"`
	ShowAllContainers bool        `yaml:"showAllContainers,omitempty"`
}

type OSConfig

type OSConfig struct {
	OpenCommand     string `yaml:"openCommand,omitempty"`
	OpenLinkCommand string `yaml:"openLinkCommand,omitempty"`
}

func GetPlatformDefaultConfig

func GetPlatformDefaultConfig() OSConfig

GetPlatformDefaultConfig gets the defaults for the platform

type StatsConfig

type StatsConfig struct {
	Graphs      []GraphConfig
	MaxDuration time.Duration `yaml:"maxDuration,omitempty"`
}

type ThemeConfig

type ThemeConfig struct {
	ActiveBorderColor   []string `yaml:"activeBorderColor,omitempty"`
	InactiveBorderColor []string `yaml:"inactiveBorderColor,omitempty"`
	OptionsTextColor    []string `yaml:"optionsTextColor,omitempty"`
}

type UpdateConfig

type UpdateConfig struct {
	Method string `yaml:"method,omitempty"`
}

type UserConfig

type UserConfig struct {
	Gui              GuiConfig              `yaml:"gui,omitempty"`
	Reporting        string                 `yaml:"reporting,omitempty"`
	ConfirmOnQuit    bool                   `yaml:"confirmOnQuit,omitempty"`
	CommandTemplates CommandTemplatesConfig `yaml:"commandTemplates,omitempty"`
	CustomCommands   CustomCommands         `yaml:"customCommands,omitempty"`
	OS               OSConfig               `yaml:"oS,omitempty"`
	Update           UpdateConfig           `yaml:"update,omitempty"`
	Stats            StatsConfig            `yaml:"stats,omitempty"`
}

func GetDefaultConfig

func GetDefaultConfig() UserConfig

GetDefaultConfig returns the application default configuration NOTE: do not default a boolean to true, because false is the boolean zero value and this will be ignored when parsing the user's config

Jump to

Keyboard shortcuts

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