fix(config): allow --config to overrule POSH_THEME

resolves #5376
This commit is contained in:
Jan De Dobbeleer 2024-07-30 12:52:56 +02:00 committed by Jan De Dobbeleer
parent 53f313999a
commit a096a40fe6

View file

@ -89,7 +89,12 @@ func (term *Terminal) Init() {
func (term *Terminal) resolveConfigPath() {
defer term.Trace(time.Now())
if poshTheme := term.Getenv("POSH_THEME"); len(poshTheme) > 0 {
// if the config flag is set, we'll use that over POSH_THEME
// in our internal shell logic, we'll always use the POSH_THEME
// due to not using --config to set the configuration
hasConfigFlag := len(term.CmdFlags.Config) > 0
if poshTheme := term.Getenv("POSH_THEME"); len(poshTheme) > 0 && !hasConfigFlag {
term.DebugF("config set using POSH_THEME: %s", poshTheme)
term.CmdFlags.Config = poshTheme
return