diff --git a/config.go b/config.go index cb1df58..c7e2ae2 100644 --- a/config.go +++ b/config.go @@ -6,6 +6,7 @@ import ( "net/http" "os" "path/filepath" + "strings" "github.com/PullRequestInc/go-gpt3" "github.com/kirsle/configdir" @@ -77,6 +78,7 @@ func (c *config) Write() error { } func ReadConfig(fileName string) (config, error) { + fileName = strings.TrimSpace(fileName) if fileName == "" { fileName = defaultConfigFilename } diff --git a/main.go b/main.go index 542b4c4..8ade9b2 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,7 @@ type mainCmd struct { Ask *askCmd `arg:"subcommand"` Config *configCmd `arg:"subcommand"` Chat *chatCmd `arg:"subcommand"` - ConfigName string `arg:"-c,--config" help:"name of the configuration set"` + ConfigName string `arg:"-c,--config,env:HLP_CONFIG" help:"name of the configuration set"` } func (args *mainCmd) SetupConfig() (config, error) {