Concept: a terminal pager, like
less for example, that interactively "folds" and "unfolds" the input file (as in emacs outline mode). Folded, a recursive directory listing might show only the directory names. Unfolded, it would show the full contents.
As another example
git log | pager
might allow the user to toggle interactively between seeing the headlines and details of each commit.
might fold/unfold functions, allowing the user to switch between seeing function definitions only and function bodies.
Obviously, the pager would need to be told (or to deduce for itself) the type of the content it was dealing with.
Does such a program exist?