config

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultConfig added in v0.2.0

func GetDefaultConfig() []byte

GetDefaultConfig returns the application default configuration

func GetPlatformDefaultConfig added in v0.8.1

func GetPlatformDefaultConfig() []byte

GetPlatformDefaultConfig gets the defaults for the platform

func LoadAndMergeFile added in v0.2.0

func LoadAndMergeFile(v *viper.Viper, filename string) error

LoadAndMergeFile Loads the config/state file, creating the file has an empty one if it does not exist

func LoadConfig added in v0.2.0

func LoadConfig(filename string, withDefaults bool) (*viper.Viper, error)

LoadConfig gets the user's config

func LoadDefaults added in v0.2.0

func LoadDefaults(v *viper.Viper, defaults []byte) error

LoadDefaults loads in the defaults defined in this file

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  *viper.Viper
	AppState    *AppState
	IsNewRepo   bool
}

AppConfig contains the base configuration fields required for lazygit.

func NewAppConfig added in v0.1.65

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

NewAppConfig makes a new app config

func (*AppConfig) GetAppState added in v0.2.0

func (c *AppConfig) GetAppState() *AppState

GetAppState returns the app state

func (*AppConfig) GetBuildDate

func (c *AppConfig) GetBuildDate() string

GetBuildDate returns debug flag

func (*AppConfig) GetBuildSource added in v0.2.0

func (c *AppConfig) GetBuildSource() string

GetBuildSource returns the source of the build. For builds from goreleaser this will be binaryBuild

func (*AppConfig) GetCommit

func (c *AppConfig) GetCommit() string

GetCommit returns debug flag

func (*AppConfig) GetDebug

func (c *AppConfig) GetDebug() bool

GetDebug returns debug flag

func (*AppConfig) GetIsNewRepo added in v0.8.1

func (c *AppConfig) GetIsNewRepo() bool

GetIsNewRepo returns known repo boolean

func (*AppConfig) GetName

func (c *AppConfig) GetName() string

GetName returns debug flag

func (*AppConfig) GetUserConfig added in v0.1.65

func (c *AppConfig) GetUserConfig() *viper.Viper

GetUserConfig returns the user config

func (*AppConfig) GetVersion

func (c *AppConfig) GetVersion() string

GetVersion returns debug flag

func (*AppConfig) LoadAppState added in v0.2.0

func (c *AppConfig) LoadAppState() error

LoadAppState loads recorded AppState from file

func (*AppConfig) SaveAppState added in v0.2.0

func (c *AppConfig) SaveAppState() error

SaveAppState marhsalls the AppState struct and writes it to the disk

func (*AppConfig) SetIsNewRepo added in v0.8.1

func (c *AppConfig) SetIsNewRepo(toSet bool)

SetIsNewRepo set if the current repo is known

func (*AppConfig) WriteToUserConfig added in v0.2.0

func (c *AppConfig) WriteToUserConfig(key, value string) error

WriteToUserConfig adds a key/value pair to the user's config and saves it

type AppConfigurer

type AppConfigurer interface {
	GetDebug() bool
	GetVersion() string
	GetCommit() string
	GetBuildDate() string
	GetName() string
	GetBuildSource() string
	GetUserConfig() *viper.Viper
	GetAppState() *AppState
	WriteToUserConfig(string, string) error
	SaveAppState() error
	LoadAppState() error
	SetIsNewRepo(bool)
	GetIsNewRepo() bool
}

AppConfigurer interface allows individual app config structs to inherit Fields from AppConfig and still be used by lazygit.

type AppState added in v0.2.0

type AppState struct {
	LastUpdateCheck int64
	RecentRepos     []string
}

AppState stores data between runs of the app like when the last update check was performed and which other repos have been checked out

Jump to

Keyboard shortcuts

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