mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-15 01:34:26 +02:00
Adding setup and config
This commit is contained in:
committed by
Jesse Duffield
parent
6df15ddf6e
commit
6f0f70bd92
@ -51,6 +51,9 @@ Default path for the config file:
|
|||||||
allBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium"
|
allBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium"
|
||||||
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
|
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
|
||||||
disableForcePushing: false
|
disableForcePushing: false
|
||||||
|
refresher:
|
||||||
|
refreshInterval: 10 # file/submodule refresh interval in seconds
|
||||||
|
fetchInterval: 60 # re-fetch interval in seconds
|
||||||
update:
|
update:
|
||||||
method: prompt # can be: prompt | background | never
|
method: prompt # can be: prompt | background | never
|
||||||
days: 14 # how often an update is checked for
|
days: 14 # how often an update is checked for
|
||||||
|
@ -4,6 +4,7 @@ type UserConfig struct {
|
|||||||
Gui GuiConfig `yaml:"gui"`
|
Gui GuiConfig `yaml:"gui"`
|
||||||
Git GitConfig `yaml:"git"`
|
Git GitConfig `yaml:"git"`
|
||||||
Update UpdateConfig `yaml:"update"`
|
Update UpdateConfig `yaml:"update"`
|
||||||
|
Refresher RefresherConfig `yaml:"refresher"`
|
||||||
Reporting string `yaml:"reporting"`
|
Reporting string `yaml:"reporting"`
|
||||||
SplashUpdatesIndex int `yaml:"splashUpdatesIndex"`
|
SplashUpdatesIndex int `yaml:"splashUpdatesIndex"`
|
||||||
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
|
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
|
||||||
@ -17,6 +18,11 @@ type UserConfig struct {
|
|||||||
NotARepository string `yaml:"notARepository"`
|
NotARepository string `yaml:"notARepository"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RefresherConfig struct {
|
||||||
|
RefreshInterval int `yaml:"refreshInterval"`
|
||||||
|
FetchInterval int `yaml:"fetchInterval"`
|
||||||
|
}
|
||||||
|
|
||||||
type GuiConfig struct {
|
type GuiConfig struct {
|
||||||
ScrollHeight int `yaml:"scrollHeight"`
|
ScrollHeight int `yaml:"scrollHeight"`
|
||||||
ScrollPastBottom bool `yaml:"scrollPastBottom"`
|
ScrollPastBottom bool `yaml:"scrollPastBottom"`
|
||||||
@ -306,6 +312,10 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
DisableForcePushing: false,
|
DisableForcePushing: false,
|
||||||
CommitPrefixes: map[string]CommitPrefixConfig(nil),
|
CommitPrefixes: map[string]CommitPrefixConfig(nil),
|
||||||
},
|
},
|
||||||
|
Refresher: RefresherConfig{
|
||||||
|
RefreshInterval: 10,
|
||||||
|
FetchInterval: 60,
|
||||||
|
},
|
||||||
Update: UpdateConfig{
|
Update: UpdateConfig{
|
||||||
Method: "prompt",
|
Method: "prompt",
|
||||||
Days: 14,
|
Days: 14,
|
||||||
|
@ -495,7 +495,7 @@ func (gui *Gui) Run() error {
|
|||||||
go utils.Safe(gui.startBackgroundFetch)
|
go utils.Safe(gui.startBackgroundFetch)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.goEvery(time.Second*10, gui.stopChan, gui.refreshFilesAndSubmodules)
|
gui.goEvery(time.Second*time.Duration(userConfig.Refresher.RefreshInterval), gui.stopChan, gui.refreshFilesAndSubmodules)
|
||||||
|
|
||||||
g.SetManager(gocui.ManagerFunc(gui.layout), gocui.ManagerFunc(gui.getFocusLayout()))
|
g.SetManager(gocui.ManagerFunc(gui.layout), gocui.ManagerFunc(gui.getFocusLayout()))
|
||||||
|
|
||||||
@ -643,8 +643,9 @@ func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function fun
|
|||||||
func (gui *Gui) startBackgroundFetch() {
|
func (gui *Gui) startBackgroundFetch() {
|
||||||
gui.waitForIntro.Wait()
|
gui.waitForIntro.Wait()
|
||||||
isNew := gui.Config.GetIsNewRepo()
|
isNew := gui.Config.GetIsNewRepo()
|
||||||
|
userConfig := gui.Config.GetUserConfig()
|
||||||
if !isNew {
|
if !isNew {
|
||||||
time.After(60 * time.Second)
|
time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second)
|
||||||
}
|
}
|
||||||
err := gui.fetch(false)
|
err := gui.fetch(false)
|
||||||
if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew {
|
if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew {
|
||||||
@ -653,7 +654,7 @@ func (gui *Gui) startBackgroundFetch() {
|
|||||||
prompt: gui.Tr.NoAutomaticGitFetchBody,
|
prompt: gui.Tr.NoAutomaticGitFetchBody,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
gui.goEvery(time.Second*60, gui.stopChan, func() error {
|
gui.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), gui.stopChan, func() error {
|
||||||
err := gui.fetch(false)
|
err := gui.fetch(false)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user