fix: respect all config file provided width values

Fixes #752
This commit is contained in:
Matt Martz 2025-07-01 17:26:36 -05:00
commit 358c224a86
No known key found for this signature in database
GPG key ID: 40832D88E9FC91D8
2 changed files with 1 additions and 17 deletions

View file

@ -20,7 +20,7 @@ mouse: false
# use pager to display markdown
pager: false
# word-wrap at width
width: 80
width: 0
# show all files, including hidden and ignored.
all: false
`

16
main.go
View file

@ -189,22 +189,6 @@ func validateOptions(cmd *cobra.Command) error {
style = "notty"
}
// Detect terminal width
if !cmd.Flags().Changed("width") { //nolint:nestif
if isTerminal && width == 0 {
w, _, err := term.GetSize(int(os.Stdout.Fd()))
if err == nil {
width = uint(w) //nolint:gosec
}
if width > 120 {
width = 120
}
}
if width == 0 {
width = 80
}
}
return nil
}