CLI output pager 72/872/4
authorChris Luke <chrisy@flirble.org>
Mon, 25 Apr 2016 17:49:22 +0000 (13:49 -0400)
committerDave Barach <openvpp@barachs.net>
Wed, 27 Apr 2016 13:32:49 +0000 (13:32 +0000)
commit7afda3aee55bb25a274c3d1da48589a82d8c6d3b
treec2845b574a7c7ffe863ef04d1d48c48fced2c719
parent6b90fe323107b218019739ce8bb4429f83f218be
CLI output pager

Buffers output from CLI commands as it arrives and allows the terminal to
view this buffer one page at a time.

- View of the buffer is moved with space/enter/up/down/page-up/page-down/
  home/end.
- At the end of the CLI command if less than one page of output was
  generated then the pager is not engaged.
- 'q' to quit the pager, or scroll off the bottom.
- Pager prompt displays the current view aperture line numbers and total
  number of lines buffered.
- Can be disabled at runtime with "no-cli-pager" in the unix configuration.
- The number of lines that will be stored in the buffer is limited to
  prevent excessive memory use; this limit is configurable with
  "cli-pager-buffer-limit" in the unix configuration.
- Both these options can also be set in the console with "set terminal
  pager [on|off] [limit <lines>]".

Limitations:
- Does not yet implement a search function.
- Whilst the terminal size is detected and tracked, changing the terminal
  size when the pager is being used will not cause a redraw of the page.
- Lines that wrap the right most column are not yet handled gracefully.

Change-Id: I69548c1464eff79c53e122668f25758266daf1c2
Signed-off-by: Chris Luke <chrisy@flirble.org>
vlib/vlib/unix/cli.c
vlib/vlib/unix/main.c
vlib/vlib/unix/unix.h