@kaynooo/cli-view
v0.7.6
Published
view: markdown files and git diffs shown in the colours of the other @kaynooo CLIs, paged when long.
Readme
@kaynooo/cli-view
view shows a markdown file or a git diff in the colours of the other @kaynooo CLIs: the kit roles, wrapped to the terminal, paged through less -FRX when it is long. It is for a person reading in a terminal, not for a Claude Code session, which reads files with its own tools.
bun add -g @kaynooo/cli-view| Command | What it does |
| --- | --- |
| view README.md | headings with their # marks shaded by level, emphasis, lists with dashes and numbers that copy as plain text, task boxes, quotes behind a mark, code blocks between rules, tables with wrapped cells, links as OSC 8 links |
| view src/app.ts, view config.yaml | source highlighted (comments, strings, numbers, keywords, keys) behind line numbers on a terminal; ts, js, json, yaml, toml, ini, py, sh, css, html, sql, rs, go, php, java, c, rb, lua, Dockerfile, Makefile |
| view --lang ts, --no-lines | read stdin as that language; leave the line numbers off |
| git diff \| view | file headers, hunk ranges, added and removed lines coloured; a git log -p or git show too |
| view --diff, --markdown | force the reading when the first line or the file name does not say |
| --width <n>, --no-pager | wrap to a width instead of the terminal's, never page |
The text is a file, or what is piped on stdin. A diff is recognised by its first line (diff --git, --- , @@, commit <sha>) or a .diff or .patch name; anything else is markdown. With NO_COLOR, a pipe or --plain it prints without colour: links as text (url), images as [image: alt].
Code blocks in markdown are highlighted by their language too. The highlighting is a light tokenizer, not a parser: it gets comments, strings, numbers and keywords right for the common languages, and leaves a language it does not know uncoloured.
Lines wrap to COLUMNS, or 80 when the output is not a terminal. A long output on a terminal goes through $PAGER, or less -FRX when it is unset or less. In a diff the code is highlighted by the file's extension and the changed words of a paired removed and added line are reversed. A source file is recognised by its extension or --lang, and more languages than the table lists are known.
