sad CLI
sad is a text-replacement CLI with literal matching: dots and parentheses can be searched as characters without regex syntax.
- 2,051 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- Applying changes rewrites selected files; no-preview mode can commit an incorrect replacement across many files.
Install
Manual install
# replace `x86_64-unknown-linux-gnu.deb` with your desired package
wget 'https://github.com/ms-jpq/sad/releases/latest/download/x86_64-unknown-linux-gnu.deb'First GET SAD NOW block downloads a Linux x86_64 package. Select the platform-specific release package and install through its normal system method.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Applying changes rewrites selected files; no-preview mode can commit an incorrect replacement across many files.
This is third-party code. Review the repository files before installing.
What it does
sad is a CLI that takes a file list, pattern and replacement and previews the changes. Users can select changes through fzf or inspect a diff. An agent can help narrow scope and define a task-specific replacement. Git-compatible pagers such as delta provide highlighting. Regex and literal-string modes are supported. A separate mode writes changes without preview and should follow pattern and file-list review.
Who it is for. Codebase maintainers making scoped bulk replacements with reviewable change groups.
Good fit when
- A repeated string in selected files is being replaced with diff review.
- An agent has prepared a pattern, and the user accepts only some matches.
- You try a complex expression on file copies before applying it.
- A string contains special characters, so you choose literal matching instead of regex.
Not a fit when
- The task needs language-aware symbol refactoring.
- Original files cannot be preserved before bulk writes.
- A pattern changes wording or conditions without semantic review.
Example request
Prepare a sad replacement preview for these three test files and show the diff without writing until I select changes.Limitations
The tool replaces text by pattern without understanding code or sentence meaning, so inspect the proposed diff semantically. Interactive selection requires separately installed fzf; otherwise use ordinary output. The `--commit` flag writes without a preview and should not be used for the first trial. File-list delimiters and expression quoting must match the shell; test a small set of file copies before widening scope.
How to disable. Cancel selection or exit. Restore already-written replacements through Git or a backup.
FAQ
What does `--commit` do?
It writes changes without a preview.
How do I match a literal string?
Use `--exact`.
Is fzf mandatory?
No. It enables interactive selection; plain output is also available.
Can delta display the diff?
Yes. Select a compatible pager through `--pager` or `GIT_PAGER`.
What does `--unified` control?
Context lines around changes, as in diff.
Discussion
No questions or reviews yet.
Related
CLI toolsbat is a source-viewing CLI that marks Git changes and reveals whitespace and non-printable characters around an error.
Structural code search, lint and rewrite on the syntax tree, with patterns written like ordinary code
A CLI turns Git changes into a guided code walkthrough with questions and explanations written by your existing agent
The CLI replays Git changes as typing animations to present commits and working-tree edits in the terminal.
lazygit is a terminal Git interface for bisecting regressions: mark good and bad revisions while locating the faulty commit.
A CLI opens diffs and documents in a terminal so a person can annotate lines and pass feedback to a coding agent
README in short
File lists can use a null delimiter. Regex settings control case sensitivity and matching across multiple lines.