1 unstable release
new 0.1.0 | May 21, 2025 |
---|
#735 in Command line utilities
41KB
684 lines
rustscrub
A CLI tool for scrubbing sensitive data from files.
Description
rustscrub
A CLI tool for scrubbing sensitive data from files.
Version: 0.1.0 Author: volker schwaberow volker@schwaberow.de Homepage: https://schwaberow.de Repository: https://github.com/vschwaberow/rustscrub
Description
rustscrub
is a command-line interface (CLI) tool built with Rust, designed to remove comments from source code files. This can be useful for preparing code for distribution, reducing file size, or cleaning up codebases.
The tool focuses on identifying and stripping out comment blocks and lines. It is particularly useful for developers who want to share their code without exposing comments that may contain sensitive information, such as TODOs, internal notes, or any other non-essential information.
Installation
Prerequisites
- Rust programming language (latest stable version recommended). You can install Rust via rustup.
Building from source
-
Clone the repository:
git clone https://github.com/vschwaberow/rustscrub.git cd rustscrub
-
Build the project:
cargo build
For a release build (optimized):
cargo build --release
The executable will be located at
target/debug/rustscrub
ortarget/release/rustscrub
. -
(Optional) Install the binary to a directory in your PATH:
cp target/release/rustscrub ~/.local/bin/ # Adjust path as needed, e.g., /usr/local/bin
Via Crates.io (Once Published)
Once the crate is published to crates.io, you will be able to install it using:
cargo install rustscrub
Usage
The primary way to use rustscrub
is by providing an input file. The processed output can either be directed to an output file or, if no output file is specified, it might print to standard output (this behavior should be clarified as development progresses).
Basic syntax:
rustscrub <input_file_path> [OPTIONS]
Arguments:
<input_file_path>
: (Required) The path to the file that needs to be processed.
Options:
-o, --output <output_file_path>
: Specifies the path for the output file. If not provided, the behavior might be to print to standard output.-H, --header-lines <number>
: Specifies the number of header lines to preserve from the input file. Defaults to0
.-v, --verbose
: Enables verbose output, providing more details about the scrubbing process.-d, --dry-run
: Performs a dry run. It will show what would be changed without actually modifying any files or producing an output file.--help
: Displays a help message with all available commands and options.
Examples:
-
Scrub comments from
source.rs
and save the result toscrubbed_source.rs
:rustscrub source.rs -o scrubbed_source.rs
-
Scrub comments from
main.rs
, preserving the first 5 header lines, and show verbose output:rustscrub main.rs -H 5 -v -o cleaned_main.rs
-
Perform a dry run on
utils.rs
to see what would be scrubbed:rustscrub utils.rs -d
-
Display help information:
rustscrub --help
Development
Dependencies
This project uses clap
for command-line argument parsing.
[dependencies]
clap = { version = "4.4.8", features = ["derive"] }
Running Tests
cargo test
Linting and Formatting
It's recommended to use rustfmt
for formatting and clippy
for linting.
cargo fmt
cargo clippy
Contributing
Contributions are welcome! If you have an idea for a new feature, a bug fix, or improvements to the documentation, please feel free to:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Make your changes.
- Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature-name
). - Open a Pull Request.
Please ensure your code adheres to the existing style and that all tests pass.
License
This project is licensed under the MIT License. See the LICENSE
file for more details.
(You will need to create a LICENSE
file containing the text of the MIT license).
Keywords
cli, rust, scrub, security, privacy, data sanitization
Categories
Command-line utilities
Installation
Prerequisites
- Rust programming language (latest stable version recommended). You can install Rust via rustup.
Building from source
-
Clone the repository:
git clone https://github.com/vschwaberow/rustscrub.git cd rustscrub
-
Build the project:
cargo build
For a release build (optimized):
cargo build --release
The executable will be located at
target/debug/rustscrub
ortarget/release/rustscrub
. -
(Optional) Install the binary to a directory in your PATH:
cp target/release/rustscrub ~/.local/bin/ # Adjust path as needed, e.g., /usr/local/bin
Via Crates.io (Once Published)
Once the crate is published to crates.io, you will be able to install it using:
cargo install rustscrub
Usage
The primary way to use rustscrub
is by providing an input file. The processed output can either be directed to an output file or, if no output file is specified, it might print to standard output (this behavior should be clarified as development progresses).
Basic syntax:
rustscrub <input_file_path> [OPTIONS]
Arguments:
<input_file_path>
: (Required) The path to the file that needs to be processed.
Options:
-o, --output <output_file_path>
: Specifies the path for the output file. If not provided, the behavior might be to print to standard output.-H, --header-lines <number>
: Specifies the number of header lines to preserve from the input file. Defaults to0
.-v, --verbose
: Enables verbose output, providing more details about the scrubbing process.-d, --dry-run
: Performs a dry run. It will show what would be changed without actually modifying any files or producing an output file.--help
: Displays a help message with all available commands and options.
Examples:
-
Scrub comments from
source.rs
and save the result toscrubbed_source.rs
:rustscrub source.rs -o scrubbed_source.rs
-
Scrub comments from
main.rs
, preserving the first 5 header lines, and show verbose output:rustscrub main.rs -H 5 -v -o cleaned_main.rs
-
Perform a dry run on
utils.rs
to see what would be scrubbed:rustscrub utils.rs -d
-
Display help information:
rustscrub --help
Development
Dependencies
This project uses clap
for command-line argument parsing.
[dependencies]
clap = { version = "4.4.8", features = ["derive"] }
Running Tests
cargo test
Linting and Formatting
It's recommended to use rustfmt
for formatting and clippy
for linting.
cargo fmt
cargo clippy
Contributing
Contributions are welcome! If you have an idea for a new feature, a bug fix, or improvements to the documentation, please feel free to:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Make your changes.
- Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature-name
). - Open a Pull Request.
Please ensure your code adheres to the existing style and that all tests pass.
License
This project is licensed under the MIT License. See the LICENSE
file for more details.
(You will need to create a LICENSE
file containing the text of the MIT license).
Keywords
cli, rust, scrub, security, privacy, data sanitization
Categories
Command-line utilities
Dependencies
~1–1.6MB
~30K SLoC