| summary | Headless CLI for trimming text without launching the UI | ||
|---|---|---|---|
| read_when |
|
TrimmyCLI is a headless trimmer that uses the same heuristics as the app. It reads from a file or stdin and writes the trimmed text to stdout (or JSON).
swift run TrimmyCLI --trim /path/to/file
pbpaste | swift run TrimmyCLI --trim -Or install the packaged helper from the app: Settings → Advanced → “Install CLI”, which symlinks the bundled helper to /usr/local/bin/trimmy and /opt/homebrew/bin/trimmy. The app stays responsive while macOS requests administrator authorization. Paths containing shell characters are handled literally. Then you can run trimmy --help.
--trim <file>: input file (use-or omit to read stdin)--force, -f: force High aggressiveness--aggressiveness {low|normal|high}--preserve-blank-lines/--no-preserve-blank-lines--remove-box-drawing/--keep-box-drawing--json: emit{original, trimmed, transformed}--version, -v: print Trimmy CLI version--help, -h: show help
- also selects stdin on its own. Qualify a filename that matches an option, such as ./-f, to treat it as a file. Unknown arguments and invalid sensitivity levels produce an error before input is read.
0: the cleaner changed the text1: invalid arguments / no input / read error2: the cleaner did not change the text3: JSON encoding error
Text mode adds a final newline only when the trimmed text does not already end with one. That newline alone does not count as a change. JSON uses the same exit codes.
Read failures identify the input file or stdin and report the underlying error. Input must be valid UTF-8; invalid bytes are a read error, while an empty stdin stream reports that no input was provided.
Trim a file:
swift run TrimmyCLI --trim scripts/setup.sh --aggressiveness normalTrim stdin, force High aggressiveness, emit JSON:
pbpaste | swift run TrimmyCLI --trim - --force --jsonKeep blank lines but strip box-drawing:
swift run TrimmyCLI --trim notes.txt --preserve-blank-lines --remove-box-drawing