config

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigFilename = "config.yml"

Functions

func ConfigDir added in v0.23.1

func ConfigDir() string

func LogPath added in v0.23.1

func LogPath() (string, error)

Types

type AppConfig

type AppConfig struct {
	Debug            bool   `long:"debug" env:"DEBUG" default:"false"`
	Version          string `long:"version" env:"VERSION" default:"unversioned"`
	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
	UserConfigPaths  []string
	DeafultConfFiles bool
	UserConfigDir    string
	TempDir          string
	AppState         *AppState
	IsNewRepo        bool
}

AppConfig contains the base configuration fields required for lazygit.

func NewAppConfig added in v0.1.65

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

NewAppConfig makes a new app config

func NewDummyAppConfig added in v0.23.1

func NewDummyAppConfig() *AppConfig

NewDummyAppConfig creates a new dummy AppConfig for testing

func (*AppConfig) ConfigFilename added in v0.23.1

func (c *AppConfig) ConfigFilename() string

ConfigFilename returns the filename of the default config file

func (*AppConfig) GetAppState added in v0.2.0

func (c *AppConfig) GetAppState() *AppState

GetAppState returns the app state

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) GetDebug

func (c *AppConfig) GetDebug() bool

func (*AppConfig) GetName

func (c *AppConfig) GetName() string

func (*AppConfig) GetTempDir added in v0.30.1

func (c *AppConfig) GetTempDir() string

func (*AppConfig) GetUserConfig added in v0.1.65

func (c *AppConfig) GetUserConfig() *UserConfig

GetUserConfig returns the user config

func (*AppConfig) GetUserConfigDir added in v0.10.1

func (c *AppConfig) GetUserConfigDir() string

func (*AppConfig) GetUserConfigPaths added in v0.30.1

func (c *AppConfig) GetUserConfigPaths() []string

func (*AppConfig) GetVersion

func (c *AppConfig) GetVersion() string

func (*AppConfig) ReloadUserConfig added in v0.26.1

func (c *AppConfig) ReloadUserConfig() error

func (*AppConfig) SaveAppState added in v0.2.0

func (c *AppConfig) SaveAppState() error

SaveAppState marshalls the AppState struct and writes it to the disk

type AppConfigurer

type AppConfigurer interface {
	GetDebug() bool

	// build info
	GetVersion() string
	GetName() string
	GetBuildSource() string

	GetUserConfig() *UserConfig
	GetUserConfigPaths() []string
	GetUserConfigDir() string
	ReloadUserConfig() error
	GetTempDir() string

	GetAppState() *AppState
	SaveAppState() error
}

type AppState added in v0.2.0

type AppState struct {
	LastUpdateCheck     int64
	RecentRepos         []string
	StartupPopupVersion int

	// these are for custom commands typed in directly, not for custom commands in the lazygit config
	CustomCommandsHistory []string
	HideCommandLog        bool
}

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

type CommitConfig added in v0.32.1

type CommitConfig struct {
	SignOff bool   `yaml:"signOff"`
	Verbose string `yaml:"verbose"`
}

type CommitLengthConfig added in v0.23.1

type CommitLengthConfig struct {
	Show bool `yaml:"show"`
}

type CommitPrefixConfig added in v0.23.1

type CommitPrefixConfig struct {
	Pattern string `yaml:"pattern"`
	Replace string `yaml:"replace"`
}

type CustomCommand added in v0.23.1

type CustomCommand struct {
	Key         string                `yaml:"key"`
	Context     string                `yaml:"context"`
	Command     string                `yaml:"command"`
	Subprocess  bool                  `yaml:"subprocess"`
	Prompts     []CustomCommandPrompt `yaml:"prompts"`
	LoadingText string                `yaml:"loadingText"`
	Description string                `yaml:"description"`
	Stream      bool                  `yaml:"stream"`
	ShowOutput  bool                  `yaml:"showOutput"`
}

type CustomCommandMenuOption added in v0.23.1

type CustomCommandMenuOption struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Value       string `yaml:"value"`
}

type CustomCommandPrompt added in v0.23.1

type CustomCommandPrompt struct {
	Key string `yaml:"key"`

	// one of 'input', 'menu', 'confirm', or 'menuFromCommand'
	Type string `yaml:"type"`

	Title string `yaml:"title"`

	// this only apply to input prompts
	InitialValue string `yaml:"initialValue"`

	// this only applies to confirm prompts
	Body string `yaml:"body"`

	// this only applies to menus
	Options []CustomCommandMenuOption

	// this only applies to menuFromCommand
	Command     string `yaml:"command"`
	Filter      string `yaml:"filter"`
	ValueFormat string `yaml:"valueFormat"`
	LabelFormat string `yaml:"labelFormat"`
}

type GitConfig added in v0.23.1

type GitConfig struct {
	Paging              PagingConfig                  `yaml:"paging"`
	Commit              CommitConfig                  `yaml:"commit"`
	Merging             MergingConfig                 `yaml:"merging"`
	SkipHookPrefix      string                        `yaml:"skipHookPrefix"`
	AutoFetch           bool                          `yaml:"autoFetch"`
	AutoRefresh         bool                          `yaml:"autoRefresh"`
	BranchLogCmd        string                        `yaml:"branchLogCmd"`
	AllBranchesLogCmd   string                        `yaml:"allBranchesLogCmd"`
	OverrideGpg         bool                          `yaml:"overrideGpg"`
	DisableForcePushing bool                          `yaml:"disableForcePushing"`
	CommitPrefixes      map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
	// this should really be under 'gui', not 'git'
	ParseEmoji      bool      `yaml:"parseEmoji"`
	Log             LogConfig `yaml:"log"`
	DiffContextSize int       `yaml:"diffContextSize"`
}

type GuiConfig added in v0.23.1

type GuiConfig struct {
	AuthorColors              map[string]string  `yaml:"authorColors"`
	BranchColors              map[string]string  `yaml:"branchColors"`
	ScrollHeight              int                `yaml:"scrollHeight"`
	ScrollPastBottom          bool               `yaml:"scrollPastBottom"`
	MouseEvents               bool               `yaml:"mouseEvents"`
	SkipUnstageLineWarning    bool               `yaml:"skipUnstageLineWarning"`
	SkipStashWarning          bool               `yaml:"skipStashWarning"`
	SidePanelWidth            float64            `yaml:"sidePanelWidth"`
	ExpandFocusedSidePanel    bool               `yaml:"expandFocusedSidePanel"`
	MainPanelSplitMode        string             `yaml:"mainPanelSplitMode"`
	Language                  string             `yaml:"language"`
	TimeFormat                string             `yaml:"timeFormat"`
	Theme                     ThemeConfig        `yaml:"theme"`
	CommitLength              CommitLengthConfig `yaml:"commitLength"`
	SkipNoStagedFilesWarning  bool               `yaml:"skipNoStagedFilesWarning"`
	ShowListFooter            bool               `yaml:"showListFooter"`
	ShowFileTree              bool               `yaml:"showFileTree"`
	ShowRandomTip             bool               `yaml:"showRandomTip"`
	ShowCommandLog            bool               `yaml:"showCommandLog"`
	ShowBottomLine            bool               `yaml:"showBottomLine"`
	ShowIcons                 bool               `yaml:"showIcons"`
	CommandLogSize            int                `yaml:"commandLogSize"`
	SplitDiff                 string             `yaml:"splitDiff"`
	SkipRewordInEditorWarning bool               `yaml:"skipRewordInEditorWarning"`
	WindowSize                string             `yaml:"windowSize"`
}

type KeybindingBranchesConfig added in v0.23.1

type KeybindingBranchesConfig struct {
	CreatePullRequest      string `yaml:"createPullRequest"`
	ViewPullRequestOptions string `yaml:"viewPullRequestOptions"`
	CopyPullRequestURL     string `yaml:"copyPullRequestURL"`
	CheckoutBranchByName   string `yaml:"checkoutBranchByName"`
	ForceCheckoutBranch    string `yaml:"forceCheckoutBranch"`
	RebaseBranch           string `yaml:"rebaseBranch"`
	RenameBranch           string `yaml:"renameBranch"`
	MergeIntoCurrentBranch string `yaml:"mergeIntoCurrentBranch"`
	ViewGitFlowOptions     string `yaml:"viewGitFlowOptions"`
	FastForward            string `yaml:"fastForward"`
	PushTag                string `yaml:"pushTag"`
	SetUpstream            string `yaml:"setUpstream"`
	FetchRemote            string `yaml:"fetchRemote"`
}

type KeybindingCommitFilesConfig added in v0.23.1

type KeybindingCommitFilesConfig struct {
	CheckoutCommitFile string `yaml:"checkoutCommitFile"`
}

type KeybindingCommitsConfig added in v0.23.1

type KeybindingCommitsConfig struct {
	SquashDown                     string `yaml:"squashDown"`
	RenameCommit                   string `yaml:"renameCommit"`
	RenameCommitWithEditor         string `yaml:"renameCommitWithEditor"`
	ViewResetOptions               string `yaml:"viewResetOptions"`
	MarkCommitAsFixup              string `yaml:"markCommitAsFixup"`
	CreateFixupCommit              string `yaml:"createFixupCommit"`
	SquashAboveCommits             string `yaml:"squashAboveCommits"`
	MoveDownCommit                 string `yaml:"moveDownCommit"`
	MoveUpCommit                   string `yaml:"moveUpCommit"`
	AmendToCommit                  string `yaml:"amendToCommit"`
	ResetCommitAuthor              string `yaml:"resetCommitAuthor"`
	PickCommit                     string `yaml:"pickCommit"`
	RevertCommit                   string `yaml:"revertCommit"`
	CherryPickCopy                 string `yaml:"cherryPickCopy"`
	CherryPickCopyRange            string `yaml:"cherryPickCopyRange"`
	PasteCommits                   string `yaml:"pasteCommits"`
	TagCommit                      string `yaml:"tagCommit"`
	CheckoutCommit                 string `yaml:"checkoutCommit"`
	ResetCherryPick                string `yaml:"resetCherryPick"`
	CopyCommitAttributeToClipboard string `yaml:"copyCommitAttributeToClipboard"`
	OpenLogMenu                    string `yaml:"openLogMenu"`
	OpenInBrowser                  string `yaml:"openInBrowser"`
	ViewBisectOptions              string `yaml:"viewBisectOptions"`
}

type KeybindingConfig added in v0.23.1

type KeybindingConfig struct {
	Universal   KeybindingUniversalConfig   `yaml:"universal"`
	Status      KeybindingStatusConfig      `yaml:"status"`
	Files       KeybindingFilesConfig       `yaml:"files"`
	Branches    KeybindingBranchesConfig    `yaml:"branches"`
	Commits     KeybindingCommitsConfig     `yaml:"commits"`
	Stash       KeybindingStashConfig       `yaml:"stash"`
	CommitFiles KeybindingCommitFilesConfig `yaml:"commitFiles"`
	Main        KeybindingMainConfig        `yaml:"main"`
	Submodules  KeybindingSubmodulesConfig  `yaml:"submodules"`
}

type KeybindingFilesConfig added in v0.23.1

type KeybindingFilesConfig struct {
	CommitChanges            string `yaml:"commitChanges"`
	CommitChangesWithoutHook string `yaml:"commitChangesWithoutHook"`
	AmendLastCommit          string `yaml:"amendLastCommit"`
	CommitChangesWithEditor  string `yaml:"commitChangesWithEditor"`
	IgnoreFile               string `yaml:"ignoreFile"`
	RefreshFiles             string `yaml:"refreshFiles"`
	StashAllChanges          string `yaml:"stashAllChanges"`
	ViewStashOptions         string `yaml:"viewStashOptions"`
	ToggleStagedAll          string `yaml:"toggleStagedAll"`
	ViewResetOptions         string `yaml:"viewResetOptions"`
	Fetch                    string `yaml:"fetch"`
	ToggleTreeView           string `yaml:"toggleTreeView"`
	OpenMergeTool            string `yaml:"openMergeTool"`
	OpenStatusFilter         string `yaml:"openStatusFilter"`
}

type KeybindingMainConfig added in v0.23.1

type KeybindingMainConfig struct {
	ToggleDragSelect    string `yaml:"toggleDragSelect"`
	ToggleDragSelectAlt string `yaml:"toggleDragSelect-alt"`
	ToggleSelectHunk    string `yaml:"toggleSelectHunk"`
	PickBothHunks       string `yaml:"pickBothHunks"`
	EditSelectHunk      string `yaml:"editSelectHunk"`
}

type KeybindingStashConfig added in v0.23.1

type KeybindingStashConfig struct {
	PopStash    string `yaml:"popStash"`
	RenameStash string `yaml:"renameStash"`
}

type KeybindingStatusConfig added in v0.23.1

type KeybindingStatusConfig struct {
	CheckForUpdate      string `yaml:"checkForUpdate"`
	RecentRepos         string `yaml:"recentRepos"`
	AllBranchesLogGraph string `yaml:"allBranchesLogGraph"`
}

type KeybindingSubmodulesConfig added in v0.23.1

type KeybindingSubmodulesConfig struct {
	Init     string `yaml:"init"`
	Update   string `yaml:"update"`
	BulkMenu string `yaml:"bulkMenu"`
}

type KeybindingUniversalConfig added in v0.23.1

type KeybindingUniversalConfig struct {
	Quit                         string   `yaml:"quit"`
	QuitAlt1                     string   `yaml:"quit-alt1"`
	Return                       string   `yaml:"return"`
	ReturnAlt1                   string   `yaml:"return-alt1"`
	QuitWithoutChangingDirectory string   `yaml:"quitWithoutChangingDirectory"`
	TogglePanel                  string   `yaml:"togglePanel"`
	PrevItem                     string   `yaml:"prevItem"`
	NextItem                     string   `yaml:"nextItem"`
	PrevItemAlt                  string   `yaml:"prevItem-alt"`
	NextItemAlt                  string   `yaml:"nextItem-alt"`
	PrevPage                     string   `yaml:"prevPage"`
	NextPage                     string   `yaml:"nextPage"`
	ScrollLeft                   string   `yaml:"scrollLeft"`
	ScrollRight                  string   `yaml:"scrollRight"`
	GotoTop                      string   `yaml:"gotoTop"`
	GotoBottom                   string   `yaml:"gotoBottom"`
	PrevBlock                    string   `yaml:"prevBlock"`
	NextBlock                    string   `yaml:"nextBlock"`
	PrevBlockAlt                 string   `yaml:"prevBlock-alt"`
	NextBlockAlt                 string   `yaml:"nextBlock-alt"`
	NextBlockAlt2                string   `yaml:"nextBlock-alt2"`
	PrevBlockAlt2                string   `yaml:"prevBlock-alt2"`
	JumpToBlock                  []string `yaml:"jumpToBlock"`
	NextMatch                    string   `yaml:"nextMatch"`
	PrevMatch                    string   `yaml:"prevMatch"`
	StartSearch                  string   `yaml:"startSearch"`
	OptionMenu                   string   `yaml:"optionMenu"`
	OptionMenuAlt1               string   `yaml:"optionMenu-alt1"`
	Select                       string   `yaml:"select"`
	GoInto                       string   `yaml:"goInto"`
	Confirm                      string   `yaml:"confirm"`
	ConfirmAlt1                  string   `yaml:"confirm-alt1"`
	Remove                       string   `yaml:"remove"`
	New                          string   `yaml:"new"`
	Edit                         string   `yaml:"edit"`
	OpenFile                     string   `yaml:"openFile"`
	ScrollUpMain                 string   `yaml:"scrollUpMain"`
	ScrollDownMain               string   `yaml:"scrollDownMain"`
	ScrollUpMainAlt1             string   `yaml:"scrollUpMain-alt1"`
	ScrollDownMainAlt1           string   `yaml:"scrollDownMain-alt1"`
	ScrollUpMainAlt2             string   `yaml:"scrollUpMain-alt2"`
	ScrollDownMainAlt2           string   `yaml:"scrollDownMain-alt2"`
	ExecuteCustomCommand         string   `yaml:"executeCustomCommand"`
	CreateRebaseOptionsMenu      string   `yaml:"createRebaseOptionsMenu"`
	PushFiles                    string   `yaml:"pushFiles"`
	PullFiles                    string   `yaml:"pullFiles"`
	Refresh                      string   `yaml:"refresh"`
	CreatePatchOptionsMenu       string   `yaml:"createPatchOptionsMenu"`
	NextTab                      string   `yaml:"nextTab"`
	PrevTab                      string   `yaml:"prevTab"`
	NextScreenMode               string   `yaml:"nextScreenMode"`
	PrevScreenMode               string   `yaml:"prevScreenMode"`
	Undo                         string   `yaml:"undo"`
	Redo                         string   `yaml:"redo"`
	FilteringMenu                string   `yaml:"filteringMenu"`
	DiffingMenu                  string   `yaml:"diffingMenu"`
	DiffingMenuAlt               string   `yaml:"diffingMenu-alt"`
	CopyToClipboard              string   `yaml:"copyToClipboard"`
	OpenRecentRepos              string   `yaml:"openRecentRepos"`
	SubmitEditorText             string   `yaml:"submitEditorText"`
	AppendNewline                string   `yaml:"appendNewline"`
	ExtrasMenu                   string   `yaml:"extrasMenu"`
	ToggleWhitespaceInDiffView   string   `yaml:"toggleWhitespaceInDiffView"`
	IncreaseContextInDiffView    string   `yaml:"increaseContextInDiffView"`
	DecreaseContextInDiffView    string   `yaml:"decreaseContextInDiffView"`
}

damn looks like we have some inconsistencies here with -alt and -alt1

type LogConfig added in v0.31.1

type LogConfig struct {
	Order          string `yaml:"order"`     // one of date-order, author-date-order, topo-order
	ShowGraph      string `yaml:"showGraph"` // one of always, never, when-maximised
	ShowWholeGraph bool   `yaml:"showWholeGraph"`
}

type MergingConfig added in v0.23.1

type MergingConfig struct {
	ManualCommit bool   `yaml:"manualCommit"`
	Args         string `yaml:"args"`
}

type OSConfig added in v0.23.1

type OSConfig struct {
	// EditCommand is the command for editing a file
	EditCommand string `yaml:"editCommand,omitempty"`

	// EditCommandTemplate is the command template for editing a file
	EditCommandTemplate string `yaml:"editCommandTemplate,omitempty"`

	// OpenCommand is the command for opening a file
	OpenCommand string `yaml:"openCommand,omitempty"`

	// OpenCommand is the command for opening a link
	OpenLinkCommand string `yaml:"openLinkCommand,omitempty"`
}

OSConfig contains config on the level of the os

func GetPlatformDefaultConfig added in v0.2.2

func GetPlatformDefaultConfig() OSConfig

GetPlatformDefaultConfig gets the defaults for the platform

type PagingConfig added in v0.23.1

type PagingConfig struct {
	ColorArg  string `yaml:"colorArg"`
	Pager     string `yaml:"pager"`
	UseConfig bool   `yaml:"useConfig"`
}

type RefresherConfig added in v0.25.1

type RefresherConfig struct {
	RefreshInterval int `yaml:"refreshInterval"`
	FetchInterval   int `yaml:"fetchInterval"`
}

type ThemeConfig added in v0.23.1

type ThemeConfig struct {
	ActiveBorderColor         []string `yaml:"activeBorderColor"`
	InactiveBorderColor       []string `yaml:"inactiveBorderColor"`
	OptionsTextColor          []string `yaml:"optionsTextColor"`
	SelectedLineBgColor       []string `yaml:"selectedLineBgColor"`
	SelectedRangeBgColor      []string `yaml:"selectedRangeBgColor"`
	CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"`
	CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"`
	UnstagedChangesColor      []string `yaml:"unstagedChangesColor"`
	DefaultFgColor            []string `yaml:"defaultFgColor"`
}

type UpdateConfig added in v0.23.1

type UpdateConfig struct {
	Method string `yaml:"method"`
	Days   int64  `yaml:"days"`
}

type UserConfig added in v0.23.1

type UserConfig struct {
	Gui                  GuiConfig        `yaml:"gui"`
	Git                  GitConfig        `yaml:"git"`
	Update               UpdateConfig     `yaml:"update"`
	Refresher            RefresherConfig  `yaml:"refresher"`
	ConfirmOnQuit        bool             `yaml:"confirmOnQuit"`
	QuitOnTopLevelReturn bool             `yaml:"quitOnTopLevelReturn"`
	Keybinding           KeybindingConfig `yaml:"keybinding"`
	// OS determines what defaults are set for opening files and links
	OS                           OSConfig          `yaml:"os,omitempty"`
	DisableStartupPopups         bool              `yaml:"disableStartupPopups"`
	CustomCommands               []CustomCommand   `yaml:"customCommands"`
	Services                     map[string]string `yaml:"services"`
	NotARepository               string            `yaml:"notARepository"`
	PromptToReturnFromSubprocess bool              `yaml:"promptToReturnFromSubprocess"`
}

func GetDefaultConfig added in v0.2.0

func GetDefaultConfig() *UserConfig

Jump to

Keyboard shortcuts

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