-
Notifications
You must be signed in to change notification settings - Fork 36
Wrap panic messages at the terminal width #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c78ede6 to
a53592a
Compare
internal/app/table_failed.go
Outdated
| width, _, err := term.GetSize(int(os.Stdout.Fd())) | ||
| if err != nil { | ||
| width = 80 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
96 is used for dividers. Should we use it here as well?
tparse/internal/app/table_failed.go
Line 47 in 553d204
| Width(96) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried using the terminal width (with a fallback to 96) for both panic messages and dividers in 4ee4e5e
| import ( | ||
| "fmt" | ||
| "os" | ||
| "sort" | ||
| "strings" | ||
|
|
||
| "github.com/charmbracelet/lipgloss" | ||
|
|
||
| "github.com/mfridman/tparse/parse" | ||
| "golang.org/x/term" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The classic blocks for ordering are
- std lib
- new line
- external dependencies
- new line
- subpackages of current module
So here, it should be
import (
"fmt"
"os"
"sort"
"strings"
"github.com/charmbracelet/lipgloss"
"golang.org/x/term"
"github.com/mfridman/tparse/parse"
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by ce79ac6
go.mod
Outdated
| github.com/rivo/uniseg v0.4.7 // indirect | ||
| github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect | ||
| golang.org/x/sys v0.33.0 // indirect | ||
| golang.org/x/term v0.32.0 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run go mod tidy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by 8fe7ca3. Please let me know if you want me to squash commits.
mfridman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR 🚀
What
Wrap the panic message at the terminal width.
Why
Closes #140
How Tested
tparseoutput is wrapped at 80 characters when the terminal width is 80 characters.Ref
The latest version without this change outputs a lot of trailing spaces which result in a lot of blank lines.