diff --git a/Cargo.lock b/Cargo.lock index 293877e..11dd848 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,4 +4,4 @@ version = 3 [[package]] name = "tread" -version = "0.2.0" +version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index dc82f9b..9ec0f26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "tread" -version = "0.2.0" +version = "0.3.0" edition = "2021" rust-version = "1.75" -description = "A terminal reader for markdown, CSV and JSON. Zero dependencies." +description = "A terminal reader for markdown, CSV, JSON and source code. Zero dependencies." repository = "https://github.com/viict/tread" license = "MIT OR Apache-2.0" readme = "README.md" -keywords = ["pager", "markdown", "csv", "json", "tui"] +keywords = ["pager", "markdown", "csv", "json", "code"] categories = ["command-line-utilities", "text-processing"] [[bin]] diff --git a/README.md b/README.md index fd57d98..a8bb9f8 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ `less`, but it understands file types. -A terminal reader for markdown, CSV, JSON and JSON Lines. Collapsible -headings, banner H1s, real box-drawn tables, colored links, and navigation -across a corpus of linked documents — and for data, files far too big to load: +A terminal reader for markdown, CSV, JSON, JSON Lines and source code. +Collapsible headings, banner H1s, real box-drawn tables, colored links, and +navigation across a corpus of linked documents — in code, the same folds over +declarations and the same `Enter` over an import — and for data, files far too +big to load: a multi-GB CSV or JSON opens in milliseconds, because nothing reads the whole file. One static binary, no runtime, no configuration, **no dependencies at all** — not even `libc`. Every format is compiled in; nothing is ever loaded at @@ -107,8 +109,12 @@ $ tread --index ~/notes | CSV | `.csv`, `.tsv` | any size; sniffed delimiter, `sep=` directive | | JSON | `.json` | any size; foldable tree, source-faithful values | | JSON Lines | `.jsonl`, `.ndjson` | any size; one record per line, lenses | +| Code | `.rs`, `.ts` `.tsx` `.js` `.jsx` `.mjs` `.cjs`, `.py` `.pyi`, `.java` | folds over declarations, `Enter` follows an import | +| Plain text | `.txt`, `.text`, and any extension naming no parser | the file's lines, verbatim | -Anything unnamed — a pipe — is sniffed. `--format` forces the choice. +Anything unnamed — a pipe — is sniffed. `--format` forces the choice among +`md`, `csv`, `json`, `jsonl` and `text`; code is chosen by extension, since a +file that does not lex cleanly falls back to plain source on its own. ## Build from source @@ -563,7 +569,7 @@ every syscall is a hand-written `extern "C"` declaration. ``` $ cargo tree -tread v0.2.0 +tread v0.3.0 ``` All `unsafe` lives in the platform backends under [`src/sys/`](src/sys/); every diff --git a/src/cli.rs b/src/cli.rs index ba54b82..aa8dc46 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -78,7 +78,7 @@ impl fmt::Display for CliError { pub fn help_text() -> String { format!( "\ -{BIN} {VERSION} — a terminal reader for markdown, CSV and JSON +{BIN} {VERSION} — a terminal reader for markdown, CSV, JSON and code USAGE {BIN} [OPTIONS] [FILE]