Documentation ¶
Index ¶
- func GetDefaultConfig() []byte
- func LoadAndMergeFile(v *viper.Viper, filename string) error
- func LoadConfig(filename string, defaults []byte) (*viper.Viper, error)
- func LoadDefaults(v *viper.Viper, defaults []byte) error
- type AppConfig
- func (c *AppConfig) GetAppState() *AppState
- func (c *AppConfig) GetBuildDate() string
- func (c *AppConfig) GetBuildSource() string
- func (c *AppConfig) GetCommit() string
- func (c *AppConfig) GetDebug() bool
- func (c *AppConfig) GetName() string
- func (c *AppConfig) GetUserConfig() *viper.Viper
- func (c *AppConfig) GetVersion() string
- func (c *AppConfig) LoadAppState() error
- func (c *AppConfig) SaveAppState() error
- func (c *AppConfig) WriteToUserConfig(key, value string) error
- type AppConfigurer
- type AppState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultConfig ¶ added in v0.2.0
func GetDefaultConfig() []byte
func LoadAndMergeFile ¶ added in v0.2.0
LoadAndMergeFile Loads the config/state file, creating the file as an empty one if it does not exist
func LoadConfig ¶ added in v0.2.0
LoadConfig gets the user's config
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 }
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
GetAppState returns the app state
func (*AppConfig) GetBuildDate ¶
GetBuildDate returns debug flag
func (*AppConfig) GetBuildSource ¶ added in v0.2.0
GetBuildSource returns the source of the build. For builds from goreleaser this will be binaryBuild
func (*AppConfig) GetUserConfig ¶ added in v0.1.65
GetUserConfig returns the user config
func (*AppConfig) GetVersion ¶
GetVersion returns debug flag
func (*AppConfig) LoadAppState ¶ added in v0.2.0
func (*AppConfig) SaveAppState ¶ added in v0.2.0
SaveAppState marhsalls the AppState struct and writes it to the disk
func (*AppConfig) WriteToUserConfig ¶ added in v0.2.0
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 }
AppConfigurer interface allows individual app config structs to inherit Fields from AppConfig and still be used by lazygit.