fix: setup does not overwrites old values

This commit is contained in:
Eugen Eisler 2024-10-21 16:22:08 +02:00
parent 1b7a1fa652
commit aaddc95ec0
3 changed files with 7 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func NewClient() (ret *Client) {
ConfigureCustom: ret.configure,
}
ret.ApiUrl = ret.PluginBase.AddSetupQuestionCustom("API URL", true,
ret.ApiUrl = ret.AddSetupQuestionCustom("API URL", true,
"Enter your Ollama URL (as a reminder, it is usually http://localhost:11434)")
return

View File

@ -183,6 +183,11 @@ func (o *SetupQuestion) Ask(label string) (err error) {
func (o *SetupQuestion) OnAnswer(answer string) (err error) {
o.Value = answer
if o.EnvVariable != "" {
if err = os.Setenv(o.EnvVariable, answer); err != nil {
return
}
}
err = o.IsValidErr()
return
}

View File

@ -17,7 +17,7 @@ func NewLanguage() (ret *Language) {
ConfigureCustom: ret.configure,
}
ret.DefaultLanguage = ret.PluginBase.AddSetupQuestionCustom("Output", false,
ret.DefaultLanguage = ret.AddSetupQuestionCustom("Output", false,
"Enter your default output language (for example: zh_CN)")
return