snakit

Crates.iosnakit
lib.rssnakit
version
sourcesrc
created_at2025-02-02 16:54:27.669781
updated_at2025-02-02 17:59:42.752158
descriptionCommand-line tool that recursively renames all files and folders within a specified directory to snake_case.
homepage
repositoryhttps://github.com/TahaHachana/snakit
max_upload_size
id1539712
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Taha Hachana (TahaHachana)

documentation

README

snakit

snakit is a command-line tool written in Rust that recursively renames all files and directories in a given directory to snake_case.

Features

  • Recursive Renaming: Process files and subdirectories recursively.
  • Dry-Run Mode: Preview changes without modifying your filesystem.
  • Hidden File Support: Optionally include or skip hidden files and directories.
  • Verbose Output: See detailed logs of the renaming process.
  • Collision Handling: If a renamed file or folder already exists, a numeric suffix is added to ensure uniqueness.

Installation

cargo install snakit

Usage

You can execute snakit using the following syntax:

snakit <path> [OPTIONS]

Command-Line Arguments

  • <path>
    The path to the directory in which files and folders will be renamed.

Options

  • -d, --dry-run
    Enable dry run mode. Displays the changes that would be made without applying them.

  • --include-hidden
    Include hidden files and directories in the renaming process.
    (By default, hidden files and directories are skipped.)

  • -v, --verbose
    Enable verbose mode to show detailed renaming information for each file and folder processed.

Example

Perform a dry-run on a directory:

snakit ./my_directory --dry-run --verbose

Rename all files and folders in a directory:

snakit ./my_directory --verbose

How It Works

snakit reads the specified directory and processes each file and folder:

  1. It checks if the file or folder should be processed (skips symlinks and – by default – hidden files).
  2. It converts the file or folder name to snake_case using the heck crate.
  3. If the snake_case name is different from the original, it renames the file or folder.
  4. If a name collision occurs, it automatically appends a numeric suffix to generate a unique name.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • clap for command-line argument parsing.
  • anyhow for error handling.
  • heck for case conversion.
Commit count: 5

cargo fmt