CLI tilvísun¶
Yfirlit¶
snapper [OPTIONS] [FILE...]
snapper init [--dry-run]
snapper sdiff [--no-color] [-f FORMAT] <OLD> <NEW>
snapper git-diff [--no-color] [-f FORMAT] [REF] [FILE...]
snapper watch [-f FORMAT] <PATTERNS...>
snapper lsp
snapper mcp
Ef engar skrár eru gefnar les snapper af stdin og skrifar á stdout.
Valkostir¶
-f, --format <FORMAT>¶
Input format.
One of: org, latex, markdown, rst, plaintext.
Sjálfgreinist frá skráarendingu þegar sleppt er. Sjálfgefið er plaintext fyrir stdin.
--stdin-filepath <PATH>¶
Gera ráð fyrir þessu skráarheiti þegar lesið er af stdin, fyrir sjálfvirka sniðgreiningu. Gagnlegt fyrir samþættingu ritla sem pípa innihald biðminnis.
Dæmi: cat paper.org | snapper --stdin-filepath paper.org
-o, --output <FILE>¶
Skrifa úttak í skrá í stað stdout.
-i, --in-place¶
Breyta inntaksskrám á staðnum. Krefst skráarviðfanga (ekki stdin).
-w, --max-width <N>¶
Maximum line width.
Sentences exceeding this width are wrapped at atomic word boundaries (links, inline code, math, and similar tokens stay on one line).
Default: 0 (unlimited).
Also respects max_line_length from .editorconfig if present.
--clause-breaks¶
Prefer soft breaks after independent-clause punctuation (comma, semicolon, colon, em dash, ASCII --).
Off by default.
With --max-width 0 (the default), insert a newline after every such mark that is already followed by whitespace.
A sentence that is already one independent clause stays one line.
With --max-width set, overflowing sentences prefer those marks; a sentence that already fits stays on one line.
Tokens such as 1,000, 10:30, URLs, --flags, and unspaced dashes never split.
--check uses the same mode when the flag or clause_breaks config is on.
--format-code¶
After in-block comment reflow, pipe each code-block body through the formatter argv from [code.<lang>] in .snapperrc.toml (if present).
Default is off so subprocesses are never spawned unless requested.
Missing binaries, non-zero exits, and a ~30s timeout are non-fatal; the reflowed body is kept and a diagnostic may be written to stderr.
--check¶
Check mode for CI. Exits with code 1 if any file would change, without modifying anything. Prints the paths of files that would be reformatted to stderr. With no file arguments, checks stdin (JSON/SARIF on stdout, same exit codes).
--diff¶
Sýna sameinaðan diff af því sem myndi breytast, án þess að breyta neinu. Gagnlegt til rýni áður en lagt er inn. Hættir með kóða 1 ef einhver skrá myndi breytast.
--range <START:END>¶
Aðeins sníða línur innan tiltekins bils (1-númerað, meðtalið). Línur utan bilsins fara í gegn óbreyttar. Gagnlegt fyrir samþættingu sniðvals í ritli.
Dæmi: snapper --range 10:20 paper.org
--output-format <text|json|sarif>¶
Úttakssnið fyrir --check stillingu. Sjálfgefið: text (prentar skráarnöfn á stderr).
json: outputs a JSON array of files, each withwould_reformatand adiagnosticsarray of 1-indexedline/kind(fused/wrap/long) /excerptsarif: outputs SARIF v2.1.0 for GitHub Code Scanning, with one result per diagnostic (snapper/fused,snapper/wrap,snapper/long) plussnapper/needs-reformatwhen the file would change
--strict-long¶
Treat advisory long diagnostics as --check failures.
A long finding is never the sole cause of exit 1 unless this flag is set.
The threshold is --max-width when that is non-zero, otherwise long_threshold from .snapperrc.toml (default 120).
--neural¶
Nota taugakerfisstuðða setningargreiningu gegnum nnsplit (bæta-stigs LSTM, tract-bakendi). Hleður niður og vistar eredlíkanið (~4MB) í ~/.cache/nnsplit/ við fyrstu notkun. Reglubundin greining er áfram sjálfgefin (hraðvirkari, betri meðhöndlun skammstafana). Taugakerfisgreining er yfirburða fyrir texta á öðrum tungumálum en ensku.
--lang <CODE>¶
Tungumál fyrir taugakerfissetningargreiningu. Sjálfgefið: en. Tiltæk: en, de, fr, no, sv, zh, tr, ru, uk.
--model-path <PATH>¶
Slóð að sérsniðinni ONNX eredlíkansskrá fyrir taugakerfisgreiningu. Yfirgegnir --lang.
--use-pandoc¶
Require the pandoc path (auto FFI, then CLI).
Parse may use in-process FFI when libsnapper_pandoc loads; the writer still needs pandoc on PATH (libsnapper_pandoc is reader-only) unless that library exports a writer.
Without FFI, both parse and write use the pandoc CLI.
A missing binary is an explicit error (never silent all-prose).
Enables support for typst, asciidoc, docx, html, and all other pandoc-supported formats.
The default (omit this flag) already uses pandoc when an FFI writer or pandoc on PATH is available.
--native¶
Force today’s native line parsers (markdown / org / rst / latex / plaintext).
Conflicts with --use-pandoc.
Use this when you want source-oriented splice instead of the pandoc writer.
Editors, wasm, and LSP stay native even without this flag.
--pandoc-backend <auto|ffi|cli>¶
How to obtain the pandoc AST when the pandoc path is used.
auto (default) prefers in-process FFI, else CLI.
ffi requires libsnapper_pandoc (explicit error if missing).
cli uses a pandoc subprocess (explicit error if missing).
The writer still needs pandoc on PATH when the FFI library has no writer.
--config <PATH>¶
Slóð að .snapperrc.toml stillingarskrá. Þegar sleppt er leitar snapper frá núverandi möppu og upp á við.
-h, --help¶
Prenta hjálparskilaboð.
-V, --version¶
Prenta útgáfunúmer.
--color <WHEN>¶
When to color --diff / sdiff / git-diff output: auto (default), always, or never.
Global.
sdiff and git-diff also accept --no-color as an alias for --color never.
Undirskipanir¶
snapper init¶
Frumstilla snapper fyrir verkefni. Greinir hvaða textasnið eru til staðar í möpputrénu og býr til:
.snapperrc.tomlmeð skynsamlegum sjálfgildum.gitattributesfærslur fyrir git smudge/clean síunapre-commit hook bútur
Apheleia (Emacs) stillingabútur
Notaðu --dry-run til að forskoða án þess að skrifa skrár.
snapper sdiff <OLD> <NEW>¶
Sentence-level diff between two files.
Parses both files, extracts sentences, diffs at sentence granularity.
Whitespace reflow produces zero diff.
Colored output by default; use --no-color to disable.
Exits with code 1 if differences found.
snapper git-diff [REF] [FILE...]¶
Sentence-level diff against a git ref.
Default ref: HEAD.
If no files specified, diffs all changed recognized prose files (.org, .tex, .latex, .md, .markdown, .rst, .rest, .txt).
Uses git show REF:path to retrieve the old version.
snapper watch <PATTERNS...>¶
Watch files and auto-reformat on save. Accepts file paths or glob patterns. 200ms debounce to avoid reformatting during rapid saves. Press Ctrl+C to stop.
snapper lsp¶
Start the Language Server Protocol server on stdin/stdout. Provides document formatting, range formatting, and diagnostics (flags lines with multiple sentences). Works with any LSP-compatible editor (Neovim, Emacs eglot, VS Code, Helix).
snapper mcp¶
Start the MCP server on stdin/stdout.
Tools: format_text, detect_format, check_formatting, split_sentences.
Published binaries include this server (mcp is a default Cargo feature).
Útgangskóðar¶
0: Success (or--check/--diffwith no changes needed; advisorylongdiagnostics do not fail--checkunless--strict-long)1:--checkor--difffound files that would change,--strict-longsaw alongdiagnostic, or any error