kart
kart copied to clipboard
Add output pager to verbose commands
This came up as part of #48. Some commands generate a lot of output, and mostly we don't pipe them to a pager at the moment.
Some of our commands exec git directly, so those may use a pager already, but over time more of the commands will probably be directly implemented in sno rather than execcing git.
We should add an output pager (presumably usually less) and ways of customising it.
Looks like Click already has a solution for this (and further down the same page, "Launching Editors") 👏
We should start by trying that out
LGTM. So to implement that, we need to:
- change all the output-format functions to
yield click.style(s, ...)everywhere rather thanclick.secho(s, ...) - make
diff_with_writerresponsible for resolving output paths to file objects, rather than the individual output-format functions - make
diff_with_writersend generated output to aclick.echo_via_pager(...)
Other (than show/diff) commands are probably a bit simpler but also in less need of a pager. log already has a pager because it execs git directly