This commit is contained in:
sivel / Matt Martz 2026-08-06 12:12:56 +08:00 committed by GitHub
commit a8be3315fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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

@ -191,22 +191,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
}