This commit is contained in:
Gennadiy Volkov 2026-08-04 18:41:34 +04:00 committed by GitHub
commit 39e1291a3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

13
main.go
View file

@ -179,7 +179,16 @@ func validateOptions(cmd *cobra.Command) error {
}
// validate the glamour style
// via cfg, mirroring the TUI path
cfg, err := env.ParseAs[ui.Config]()
if err != nil {
return fmt.Errorf("error parsing config: %v", err)
}
style = viper.GetString("style")
if cfg.GlamourStyle != "" {
style = cfg.GlamourStyle
}
if err := validateStyle(style); err != nil {
return err
}
@ -191,6 +200,10 @@ func validateOptions(cmd *cobra.Command) error {
style = "notty"
}
if cfg.GlamourMaxWidth != 0 {
width = cfg.GlamourMaxWidth
}
// Detect terminal width
if !cmd.Flags().Changed("width") { //nolint:nestif
if isTerminal && width == 0 {