2 releases
new 0.1.1 | Jan 14, 2025 |
---|---|
0.1.0 | Jan 14, 2025 |
#1 in #bodies
7KB
58 lines
Replace function body with todo!()
Usage
todo-replace <file-path> <csv-path>
Where is a comma separated value file with each row consists of two columns: function_name
and body
.
function_name
: The name of the function to be replaced.body
: The new body of the function. If empty, it will be replaced with default{ todo!() }
. Note thatbody
should begin and end with brackets{}
, and after replacement, formatting may be off. You may need to runcargo fmt
to fix it.
Example
Rust File (input.rs):
fn foo() {
println!(\"Old body\");
}
fn bar() {
println!(\"Another body\");
}
CSV File (replacements.csv):
foo,{ println!(\"New body\"); }
bar,{ println!(\"Updated body\"); }
Command:
todo-replacer input.rs replacements.csv
Resulting Rust File (input.rs):
fn foo() { println!(\"New body\"); }
fn bar() { println!(\"Updated body\"); }
Dependencies
~4–11MB
~120K SLoC