Skip to content

Commit

Permalink
Merge pull request #37 from chermehdi/feature/version-sync
Browse files Browse the repository at this point in the history
Add explicit version numbers.
  • Loading branch information
chermehdi authored Apr 2, 2020
2 parents 67a123a + 46f4ffb commit 785fcff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"gopkg.in/yaml.v2"
)

const LatestVersion = "0.2.0"

// The configuration of the CLI
type Config struct {
Server struct {
Expand Down Expand Up @@ -52,7 +54,7 @@ func createDefaultConfiguration() *Config {
}{
Default: "cpp",
},
Version: "0.1.0",
Version: LatestVersion,
ConfigFileName: "egor-meta.json",
CppLibraryLocation: path.Join(homeDir, "include"),
}
Expand Down Expand Up @@ -89,6 +91,12 @@ func LoadConfiguration(location string) (*Config, error) {
if err != nil {
return nil, err
}
// Check if the current version (maybe the user already has a configuration file)
// is an older version. and update accordingly
if config.Version < LatestVersion {
config.Version = LatestVersion
_ = SaveConfiguration(&config)
}
return &config, nil
}

Expand Down

0 comments on commit 785fcff

Please sign in to comment.