mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-01 13:17:53 +02:00
commit
d8aba3aeee
@ -190,6 +190,7 @@ func (c *AppConfig) SaveAppState() error {
|
|||||||
return ioutil.WriteFile(filepath, marshalledAppState, 0644)
|
return ioutil.WriteFile(filepath, marshalledAppState, 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadAppState loads recorded AppState from file
|
||||||
func (c *AppConfig) LoadAppState() error {
|
func (c *AppConfig) LoadAppState() error {
|
||||||
filepath, err := prepareConfigFile("state.yml")
|
filepath, err := prepareConfigFile("state.yml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -205,6 +206,7 @@ func (c *AppConfig) LoadAppState() error {
|
|||||||
return yaml.Unmarshal(appStateBytes, c.AppState)
|
return yaml.Unmarshal(appStateBytes, c.AppState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDefaultConfig returns the application default configuration
|
||||||
func GetDefaultConfig() []byte {
|
func GetDefaultConfig() []byte {
|
||||||
return []byte(
|
return []byte(
|
||||||
`gui:
|
`gui:
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Update checks for updates and does updates
|
// Updater checks for updates and does updates
|
||||||
type Updater struct {
|
type Updater struct {
|
||||||
Log *logrus.Entry
|
Log *logrus.Entry
|
||||||
Config config.AppConfigurer
|
Config config.AppConfigurer
|
||||||
@ -30,7 +30,7 @@ type Updater struct {
|
|||||||
Tr *i18n.Localizer
|
Tr *i18n.Localizer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updater implements the check and update methods
|
// Updaterer implements the check and update methods
|
||||||
type Updaterer interface {
|
type Updaterer interface {
|
||||||
CheckForNewUpdate()
|
CheckForNewUpdate()
|
||||||
Update()
|
Update()
|
||||||
@ -78,6 +78,7 @@ func (u *Updater) getLatestVersionNumber() (string, error) {
|
|||||||
return dat["tag_name"].(string), nil
|
return dat["tag_name"].(string), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RecordLastUpdateCheck records last time an update check was performed
|
||||||
func (u *Updater) RecordLastUpdateCheck() error {
|
func (u *Updater) RecordLastUpdateCheck() error {
|
||||||
u.Config.GetAppState().LastUpdateCheck = time.Now().Unix()
|
u.Config.GetAppState().LastUpdateCheck = time.Now().Unix()
|
||||||
return u.Config.SaveAppState()
|
return u.Config.SaveAppState()
|
||||||
|
@ -83,6 +83,7 @@ func GetProjectRoot() string {
|
|||||||
return strings.Split(dir, "lazygit")[0] + "lazygit"
|
return strings.Split(dir, "lazygit")[0] + "lazygit"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Loader dumps a string to be displayed as a loader
|
||||||
func Loader() string {
|
func Loader() string {
|
||||||
characters := "|/-\\"
|
characters := "|/-\\"
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user