#body #bodies #file #file-input

app todo-replacer

Replace function body with todo!()

2 releases

0.1.1 Jan 14, 2025
0.1.0 Jan 14, 2025

#1211 in Encoding

Download history 152/week @ 2025-01-09 60/week @ 2025-01-16 1/week @ 2025-01-30 1/week @ 2025-02-06

108 downloads per month

MIT/Apache

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 that body should begin and end with brackets {}, and after replacement, formatting may be off. You may need to run cargo 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–15MB
~121K SLoC