From 2b6a2b89563eb52d1d2383c634487d818a927661 Mon Sep 17 00:00:00 2001 From: Marwan Hawari <59078997+marwanhawari@users.noreply.github.com> Date: Fri, 5 Apr 2024 00:48:43 -0700 Subject: [PATCH] fix: config path suggestions (#39) --- cmd/config.go | 7 ++----- lib/config.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) 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 }