package console
Build not yet checked sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Colours, tables, trees and progress rows for the terminal
Install
dune-project
Dependency
Authors
Maintainers
Sources
console-0.10.1.tbz
sha256=37ad65f6833c65814b0673f009f6b656c5194608ca03519da2e63e1051d54f6e
sha512=7677067f1a3244779cdbc5c90a8b0e1eba30c3fd58281584ea3d4c46c3e219eef0668588ca0e2938799c61a3fa831ce2146eac73717214d7baf96b497bfcd892
doc/index.html
console
Colours, tables, trees and progress rows for OCaml command-line tools.
console prints into the terminal's normal scrollback and, while work runs, redraws only the progress rows of a Console.Display.
Its widgets lay out text in a style and print with Fmt, in the colours and the Console.Theme of the formatter that prints them, or as plain text on a pipe:
# let sizes =
Console.Table.(
view
[
column (Console.View.text "Package");
column ~align:`Right (Console.View.text "Size");
]
[
[ Console.View.text "console"; Console.View.text "42 KiB" ];
[ Console.View.text "console-eio"; Console.View.text "9 KiB" ];
]);;
val sizes : Console.View.t = <abstr>
# Fmt.pr "%a@." Console.View.pp sizes;;
╭─────────────┬────────╮
│ Package │ Size │
├─────────────┼────────┤
│ console │ 42 KiB │
│ console-eio │ 9 KiB │
╰─────────────┴────────╯
- : unit = ()Manuals
- Widgets and themes shows the widgets with the text they print, and how the themes draw them.
- The
console-eiopackage runs the progress rows with Eio. Its documentation opens with a tutorial, A first CLI, which builds a whole command step by step, with options for colour and theme, a table, progress rows and a test of its output.
Libraries
The console package has five libraries:
console, the moduleConsole: styles, views, the widgets, the themes, tasks, the liveConsole.Displayand how tasks show on it,Console.Progress. It needs neither Eio nor Unix.console.tty, the moduleConsole_tty: colour, colour depth and UTF-8 for the standard outputs, decided from the terminal and the environment or from a--coloroption.console.cli, the moduleConsole_cli:--colorand--themeoptions for a Cmdliner program, applied to both standard outputs and to the program's theme.console.text, the moduleConsole_text: untrusted text made safe to print, without the rest ofconsole.console.input, the moduleConsole_input: a line editor that turns the bytes typed into echo and lines, and does no input or output itself.
Where to start
Console.ViewandConsole.Stylefor text in colour.Console.Table,Console.Tree,Console.Panel,Console.RuleandConsole.Barfor the widgets.Console.Themeto choose a look, andConsole_cli.setupto let users choose one with a--themeoption.Console.TaskandConsole.Progressfor the progress rows and what a pipe gets,Console_eio, in theconsole-eiopackage, for where the program's text goes, andConsole.Displayfor what a live region guarantees.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page