diff --git a/cmd/config.go b/cmd/config.go index 2b98696..a009354 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -23,12 +23,9 @@ func Config() { return } - defaultStewPath, err := stew.GetDefaultStewPath(userOS) + config, err := stew.ReadStewConfigJSON(stewConfigFilePath) stew.CatchAndExit(err) - defaultStewBinPath, err := stew.GetDefaultStewBinPath(userOS) - stew.CatchAndExit(err) - - newStewPath, newStewBinPath, err := stew.PromptConfig(defaultStewPath, defaultStewBinPath) + newStewPath, newStewBinPath, err := stew.PromptConfig(config.StewPath, config.StewBinPath) stew.CatchAndExit(err) newStewConfig := stew.StewConfig{StewPath: newStewPath, StewBinPath: newStewBinPath} diff --git a/lib/config.go b/lib/config.go index 07a52c0..c2494cc 100644 --- a/lib/config.go +++ b/lib/config.go @@ -87,7 +87,7 @@ type StewConfig struct { StewBinPath string `json:"stewBinPath"` } -func readStewConfigJSON(stewConfigFilePath string) (StewConfig, error) { +func ReadStewConfigJSON(stewConfigFilePath string) (StewConfig, error) { stewConfigFileBytes, err := ioutil.ReadFile(stewConfigFilePath) if err != nil { @@ -141,7 +141,7 @@ func NewStewConfig(userOS string) (StewConfig, error) { return StewConfig{}, err } if configExists { - stewConfig, err = readStewConfigJSON(stewConfigFilePath) + stewConfig, err = ReadStewConfigJSON(stewConfigFilePath) if err != nil { return StewConfig{}, err }