mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-20 07:04:17 +02:00
fix(tui): respect --style / config over GLAMOUR_STYLE env
When GLAMOUR_STYLE was set to a valid value such as auto or dark, the TUI ignored -s / style from flags and config. Prefer an explicit non-auto style, then fall back to the env value (#953).
This commit is contained in:
parent
53788271b3
commit
c25bfbb5af
1 changed files with 7 additions and 2 deletions
9
main.go
9
main.go
|
|
@ -353,8 +353,13 @@ func runTUI(path string, content string) error {
|
|||
return fmt.Errorf("error parsing config: %v", err)
|
||||
}
|
||||
|
||||
// use style set in env, or auto if unset
|
||||
if err := validateStyle(cfg.GlamourStyle); err != nil {
|
||||
// Prefer CLI/config style (resolved in validateOptions) when it is not
|
||||
// the default "auto". Otherwise fall back to GLAMOUR_STYLE from the
|
||||
// environment, then to auto. Previously an env value such as "auto" or
|
||||
// "dark" silently ignored `-s light` / config `style` in TUI mode (#953).
|
||||
if style != styles.AutoStyle {
|
||||
cfg.GlamourStyle = style
|
||||
} else if err := validateStyle(cfg.GlamourStyle); err != nil || cfg.GlamourStyle == "" {
|
||||
cfg.GlamourStyle = style
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue