diff --git a/README.md b/README.md index a44a0f4..5145615 100644 --- a/README.md +++ b/README.md @@ -47,18 +47,19 @@ implementation details while preserving the essential structure and interfaces. ## Features - **Removes**: - - Function bodies (with specific exceptions) - Test functions (`#[test]`) and test modules (`#[cfg(test)]`) - - Doc comments and module-level documentation when the `--no-comments` flag is - used + - Function bodies (with specific exceptions and when the + `--no-function-bodies` option is used) + - Doc comments and module-level documentation when the `--no-comments` option + is used - Implementation details of derived traits - **Preserves**: - Module structure and imports - Type definitions (structs, enums, traits) - Function signatures and interfaces - Non-test attributes (e.g., `#[derive]`) - - Doc comments and module-level documentation (unless `--no-comments` is - specified) + - Doc comments and module-level documentation (unless `--no-comments` option + is specified) - Function bodies for: - String-like return types (`String`, `&str`, `Cow`) - `Result` where `T` is string-like @@ -97,8 +98,9 @@ code-context --output-dir --no-comment ``` Options: -o, --output-dir Output directory name [default: code-context] + --no-function-bodies Remove function bodies (except for functions with string-like return types) --no-comments Remove all comments (including doc comments) - --stats Show processing statistics + --no-stats Show processing statistics --dry-run Run without writing output files --single-file Output all files into a single combined file -h, --help Print help @@ -113,25 +115,37 @@ Generated output files can be found in the - The file [`src-code-context/code_context.rs.txt`](./src-code-context/code_context.rs.txt) - was generated by passing the path to the `src` directory of this repo with the - `--single-file` flag. + was generated by passing the path to the `src` directory of this repo with + `--single-file` and `--no-function-bodies` options. - Files in the [`src-custom-suffix`](./src-custom-suffix/) directory were - generated by passing the path to the `src` directory with the - `--output-dir custom-suffix` flag. + generated by passing the path to the `src` directory with + `--output-dir custom-suffix` and `--no-function-bodies` options. -In both cases, the size reduction is 92.5% (from 70925 bytes to 5353 bytes). +In both cases, the size reduction is 92.5% (from 76371 bytes to 5744 bytes). ### Before and After Example **Before:** ```rust +/// Adds two numbers. fn add(a: i32, b: i32) -> i32 { a + b } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_add() { + assert_eq!(add(1, 2), 3); + } +} ``` -**After:** +**After using the tool with `--no-comments` and `--no-function-bodies` +options:** ```rust fn add(a: i32, b: i32) -> i32 {}