LinuxCommandLibrary

fastmod

interactive codebase-wide find and replace

TLDR

Replace string in files

$ fastmod "[old_string]" "[new_string]"
copy
Replace with regex
$ fastmod -m "[pattern]" "[replacement]"
copy
Replace in specific directory
$ fastmod "[old]" "[new]" [directory]
copy
Replace with file extension filter
$ fastmod --extensions "[py,js]" "[old]" "[new]"
copy
Accept all replacements
$ fastmod --accept-all "[old]" "[new]"
copy
Preview without changes
$ fastmod --print-only "[old]" "[new]"
copy

SYNOPSIS

fastmod [options] pattern replacement [paths...]

DESCRIPTION

fastmod performs fast, interactive codemod operations across files. It searches for patterns and offers interactive confirmation for replacements, making bulk code changes safer.
The tool combines the speed of ripgrep for searching with interactive review of changes. It's designed for large-scale refactoring in codebases.

PARAMETERS

-m, --multiline

Enable multiline regex matching.
-i, --ignore-case
Case insensitive matching.
--extensions exts
Filter by file extensions.
--accept-all
Accept all replacements.
--print-only
Show matches without changing.
-d, --dir path
Search directory.
--glob pattern
Include/exclude files.
--hidden
Search hidden files.
--fixed-strings
Treat pattern as literal.

CAVEATS

Regex syntax differs from some tools. Interactive mode requires terminal. Large replacements may need review. Backup recommended before bulk changes.

HISTORY

fastmod was developed at Facebook (Meta) as a tool for large-scale code modifications. It addresses the need for interactive, safe refactoring across massive codebases. Released as open source, it uses Rust for performance.

SEE ALSO

sed(1), ripgrep(1), codemod(1), comby(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community