diff options
author | mjarkk <mkopenga@gmail.com> | 2018-12-10 13:45:03 +0100 |
---|---|---|
committer | mjarkk <mkopenga@gmail.com> | 2018-12-10 13:45:03 +0100 |
commit | 76e9582739c329fa657b327254bf010c560ac5e8 (patch) | |
tree | 3a4aa87e4ff66c986974b792ef68ecefa396f758 /pkg/config | |
parent | 50f20de8f34b53b808710e91fea501cb1e26ff89 (diff) |
Not always git fetch
Diffstat (limited to 'pkg/config')
-rw-r--r-- | pkg/config/app_config.go | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 48cf2df35..18aa961bc 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -20,6 +20,7 @@ type AppConfig struct { BuildSource string `long:"build-source" env:"BUILD_SOURCE" default:""` UserConfig *viper.Viper AppState *AppState + IsNewRepo bool } // AppConfigurer interface allows individual app config structs to inherit Fields @@ -36,6 +37,8 @@ type AppConfigurer interface { WriteToUserConfig(string, string) error SaveAppState() error LoadAppState() error + SetIsNewRepo(bool) + GetIsNewRepo() bool } // NewAppConfig makes a new app config @@ -54,6 +57,7 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg BuildSource: buildSource, UserConfig: userConfig, AppState: &AppState{}, + IsNewRepo: false, } if err := appConfig.LoadAppState(); err != nil { @@ -63,6 +67,16 @@ func NewAppConfig(name, version, commit, date string, buildSource string, debugg return appConfig, nil } +// GetIsNewRepo returns known repo boolean +func (c *AppConfig) GetIsNewRepo() bool { + return c.IsNewRepo +} + +// SetIsNewRepo set if the current repo is known +func (c *AppConfig) SetIsNewRepo(toSet bool) { + c.IsNewRepo = toSet +} + // GetDebug returns debug flag func (c *AppConfig) GetDebug() bool { return c.Debug @@ -153,7 +167,7 @@ func prepareConfigFile(filename string) (string, error) { } // LoadAndMergeFile Loads the config/state file, creating -// the file as an empty one if it does not exist +// the file has an empty one if it does not exist func LoadAndMergeFile(v *viper.Viper, filename string) error { configPath, err := prepareConfigFile(filename) if err != nil { @@ -236,16 +250,14 @@ confirmOnQuit: false // 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 AppState struct { - LastUpdateCheck int64 - RecentRepos []string - RecentPrivateRepos []string + LastUpdateCheck int64 + RecentRepos []string } func getDefaultAppState() []byte { return []byte(` lastUpdateCheck: 0 recentRepos: [] - recentPrivateRepos: [] `) } |