terminal: add paging to print, vars, args and locals (#3620)

Add automatic paging to the output of print, vars, args and locals.

Fixes #3615
This commit is contained in:
Alessandro Arzilli 2024-01-09 23:13:37 +01:00 committed by GitHub
parent 1a1e215fac
commit f8de498d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2138,6 +2138,8 @@ func (c *Commands) printVar(t *Term, ctx callContext, args string) error {
return err
}
t.stdout.pw.PageMaybe(nil)
fmt.Fprintln(t.stdout, val.MultilineString("", fmtstr))
if val.Kind == reflect.Chan {
@ -2208,6 +2210,7 @@ func (t *Term) printFilteredVariables(varType string, vars []api.Variable, filte
return err
}
match := false
t.stdout.pw.PageMaybe(nil)
for _, v := range vars {
if reg == nil || reg.Match([]byte(v.Name)) {
match = true