Skip to content

Commit

Permalink
fix: config path suggestions (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
marwanhawari authored Apr 5, 2024
1 parent 91895c8 commit 2b6a2b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions lib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 2b6a2b8

Please sign in to comment.