Skip to main content

Crate aless

Crate aless 

Source
Expand description

aless — a jless-style terminal viewer for every format the tabnas parsers read, with tabs and a watch mode that reloads a changed file while keeping your place.

The binary in main.rs owns the terminal; everything here is terminal-free and unit tested.

Modules§

alchemy
--alchemy: a program in the alchemy language, run over a document.
app
The application: tabs, modes, the key map and the command line. Pure state — the terminal is driven from main.rs, which feeds Inputs in and paints what crate::render draws from the state.
cli
The command line’s vocabulary: every option aless takes (OPTIONS) and the reference written from it. The summary -h prints, the reference --help prints, the man page and the shells’ completions (--generate) all come from the table and the topics here, and the binary’s parser refuses any option the table does not list, so none of them can name an option aless does not take, or leave one out.
clip
Copying text out: the system clipboard when the clipboard feature is on and a clipboard exists, else the terminal’s own OSC 52 sequence, which terminals such as xterm, kitty, WezTerm, iTerm2, Alacritty, foot and Windows Terminal turn into a clipboard write (over SSH too).
doc
The document model: a parsed value flattened into a pre-order arena of nodes, plus the visible-row projection the viewer scrolls through.
explorer
The file explorer: a directory tree shown through the same machinery as a document. Directories are containers, listed lazily as they are expanded and one level ahead of that (so a collapsed directory’s preview can show its count and first names); files are leaves showing size and format. Enter on a file opens it in a new tab.
export
--render: a document’s records as CSV, or the document as JSON text, streamed through the tabnas transducer and renderers rather than built into the viewer’s tree; a format written by a render its crate carries runs through the same plumbing from crate::translate.
fmt
Text forms of keys, values, paths and subtrees: what the tree pane shows, what search runs over, and what yank puts on the clipboard.
grammar
Custom grammars: ABNF text given on the command line (--grammar NAME=FILE, --grammar-expr NAME=ABNF), compiled once at startup by the tabnas ABNF compiler and kept in a process-wide registry that Format::Custom indexes.
headless
aless without a screen, for scripts and agents.
highlight
Colour for text: a pane showing its text colours each token as the text’s grammar lexed it, through tabnas-lsp’s semantic tokens, the ones its language server sends an editor.
load
Format detection and loading: a file (or a string) goes in, a positioned Doc comes out, parsed by the tabnas grammar for its format, or split into lines when no grammar claims it.
pane
Panes: the active tab’s document beside what a renderer or an alchemy program makes of it, and the program itself.
prov
Provenance: which source line and column each node came from.
render
Drawing: the whole screen as ratatui widgets, computed from the application state. Terminal-free: draw renders into a ratatui Frame, whatever backend holds it. main.rs hands it the terminal’s, and screen an in-memory one, so tests read what a user would see. The pane area holds the workspace’s panes (crate::pane), each drawing the tab it shows as a tree or as text.
search
Search patterns, jless style: regular expressions with smart case, a /s suffix to force case sensitivity, and square/curly brackets taken literally unless escaped.
tab
A tab: one open document and the view onto it (focus, scroll, fold state, mode, search), with the jless navigation semantics and the reload that keeps the reader’s place.
translate
--render <FORMAT> for any format a crate ships a render for: the registry of the formats’ translation parts, and how aless runs the translation alchemy composes from them (admin ADR-27; tabnas/transduce’s docs/translation.md).
watch
File watching: a notify watcher on each watched file’s directory (editors replace files by rename, which a watch on the file itself would not survive), forwarding change notifications as Inputs. The application also polls file stamps on its tick, so a missed event only delays a reload rather than losing it.