Crates.io | spacemod |
lib.rs | spacemod |
version | 0.1.5 |
created_at | 2023-06-25 18:58:54.057692+00 |
updated_at | 2025-09-05 19:33:23.417029+00 |
description | A easy to understand and powerful text search-and-replace tool |
homepage | https://codeberg.org/untitaker/spacemod |
repository | https://codeberg.org/untitaker/spacemod |
max_upload_size | |
id | 899752 |
size | 95,867 |
spacemod
is a text search-and-replace tool optimized towards refactoring
code.
# example.py (before)
copy_file(to_file=to_file, from_file=from_file)
copy_file(
to_file=get_file(filepath, mode),
from_file=get_file_writer(other_filepath, other_mode)
)
# Use spacemod's custom pattern-matching language to deal with whitespace easier.
# Without -S, normal regex patterns are assumed.
$ spacemod -S \
'copy_file ( to_file= (.*) , from_file= (.*) )' \
'copy_file($2, $1)' \
example.py
# spacemod will open interactive TUI and ask for approval of diffs. Use
# --accept-all to use spacemod non-interactively.
# example.py (after)
copy_file(from_file, to_file)
copy_file(get_file_writer(other_filepath, other_mode)
, get_file(filepath, mode))
It is very similar to fastmod, but with some additional features:
[u]ndo
to revert.Download the latest binary from Codeberg releases or use cargo install spacemod
.
Check the website for additional docs.
Licensed under MIT
, see ./LICENSE
.