ff: the find-fix utility.
ff is a utility command-line tool (and lua library) to find and optionally
replace lua patterns. It searches for file patterns, file content, or both. It
can also rename files and modify the content using
--sub with
--mut.
ff uses an easy to learn shorthand for many operations, displayed below:
| syntax |
equivalent |
| some_pat (no prefix) |
--pat=some_pat |
| r:some/dir/ |
--root=some/dir |
| p:path.*pattern |
--path=path.*pattern |
Patterns can be either positive (the default) or negative by
preceeding with a single -. For instance, p:-/out/ will skip any
directories named out. Matchers are applied first->last,
any positive match will immediately result in the match succeding,
whereas any negative match will immedialy result in the match failing.
Examples:
ff 'some.*pattern' # search for some.*pattern
ff r:some/root/ pat # search for pat in root
ff find --sub=fix # replace 'find' with 'fix' (display)
ff find --sub=fix --mut # actually replace 'find' with 'fix'
Note: all directories/ always end with / which you can
use to include/exclude them.
Usage:
ff find_this or_this
Arguments:
- root
list of root paths, i.e. r:path1/ r:path2
- cnt
list of patterns to find in the content
- path
p:%.lua list of file path patterns
- sub
the subsitution string to use with cnt.
- mut
mutate files (used with sub)
- dirs
show all non-excluded directories
- content =true
if false do not show content (only show paths)
- hidden =false
whether to include .hidden paths (default=false)
- pathsub
the substitution string to rename the path.
Note: this implies content=false and cannot be used with sub
- depth
depth to search from root directories
- to
where to print to
Methods and Functions