Add pager support to log output in printLogs
Introduces use of a pager for log output in the printLogs function. If the pager fails to start, an error message is printed to stderr. This improves log readability for long outputs.
This commit is contained in:
parent
dab285c61a
commit
4d9038ad31
1 changed files with 6 additions and 0 deletions
|
|
@ -325,6 +325,12 @@ func printLogs(opts *ViewOptions, capiClient capi.CapiClient, sessionID string)
|
|||
|
||||
renderer := opts.LogRenderer()
|
||||
|
||||
if err := opts.IO.StartPager(); err == nil {
|
||||
defer opts.IO.StopPager()
|
||||
} else {
|
||||
fmt.Fprintf(opts.IO.ErrOut, "error starting pager: %v\n", err)
|
||||
}
|
||||
|
||||
if opts.Follow {
|
||||
var called bool
|
||||
fetcher := func() ([]byte, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue