{"id":22348733,"url":"https://github.com/iamsauravsharma/cargo-trim","last_synced_at":"2025-04-07T13:09:57.028Z","repository":{"id":47647161,"uuid":"156066016","full_name":"iamsauravsharma/cargo-trim","owner":"iamsauravsharma","description":"Binary application to clean up .cargo/registry \u0026 .cargo/git cache","archived":false,"fork":false,"pushed_at":"2025-02-25T10:00:24.000Z","size":949,"stargazers_count":26,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T12:06:50.210Z","etag":null,"topics":["cargo","cli","crates","hacktoberfest","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamsauravsharma.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-04T09:15:22.000Z","updated_at":"2025-02-25T09:56:03.000Z","dependencies_parsed_at":"2023-11-18T04:27:26.128Z","dependency_job_id":"5dcf7bb9-8e8f-46b6-b5c6-647a8b38043a","html_url":"https://github.com/iamsauravsharma/cargo-trim","commit_stats":{"total_commits":480,"total_committers":5,"mean_commits":96.0,"dds":0.09166666666666667,"last_synced_commit":"121d0ee71d007d0e666add9e149cfa49ddb6af78"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamsauravsharma%2Fcargo-trim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamsauravsharma%2Fcargo-trim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamsauravsharma%2Fcargo-trim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamsauravsharma%2Fcargo-trim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamsauravsharma","download_url":"https://codeload.github.com/iamsauravsharma/cargo-trim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657281,"owners_count":20974345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo","cli","crates","hacktoberfest","rust","rust-lang"],"created_at":"2024-12-04T11:06:12.849Z","updated_at":"2025-04-07T13:09:57.007Z","avatar_url":"https://github.com/iamsauravsharma.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CARGO-TRIM\n\n**Project status \u0026 info:**\n\n|                    License                     |              Crates Version               |\n| :--------------------------------------------: | :---------------------------------------: |\n| [![License: MIT][license_badge]][license_link] | [![Crate][cratesio_badge]][cratesio_link] |\n\n`cargo-trim` is a binary application designed to clean up the **\\$CARGO_HOME/registry** \u0026 **\\$CARGO_HOME/git** folders,\nsupporting orphaned and outdated crate removal.\nThe default value for $CARGO_HOME is $HOME/.cargo.\n\n### Install\n\nYou can install `cargo-trim` directly from the crates.io registry:\n\n```\ncargo install cargo-trim\n```\n\n**OR**\n\nFor bleeding edge latest development version:\n\n```\ncargo install --git https://github.com/iamsauravsharma/cargo-trim\n```\n\n### Setup\n\nTo set up cargo-trim, initialize it in the directory where your Rust projects reside using:\n\n```bash\ncargo trim init\n```\n\nThis command can be run multiple times to add multiple directories.\n\nAlternatively, you can specify a directory manually with:\n\n```bash\ncargo trim set -d \u003cdirectory-path\u003e\n```\n\nThis setup is crucial for enabling commands like orphan cleaning, as it allows `cargo-trim` to track and manage crates across your projects.\n\n### Commands\nYou can run `cargo-trim` commands using:\n```bash\ncargo trim \u003ccommand\u003e\n```\nFor a full list of available commands, use:\n\n```bash\ncargo trim --help\n```\n\nThis will display the following output:\n```\nBinary application to cleanup $CARGO_HOME cache\n\nUsage: cargo-trim [OPTIONS] [COMMAND]\n\nCommands:\n  init      Initialize current working directory as cargo trim directory\n  clear     Clear current working directory from cargo cache config\n  config    Query about config file data used by CLI\n  set       Set config file values\n  unset     Unset values from config file\n  list      List crates\n  git       Perform operation only to git related cache file\n  registry  Perform operation only to registry related cache file\n  help      Print this message or the help of the given subcommand(s)\n\nOptions:\n  -a, --all                    Clean up all registry \u0026 git crates\n      --clear-empty-index      Clear all empty index directory\n  -d, --directory \u003cDIRECTORY\u003e  Extra list of directory of Rust projects for current command [env: TRIM_DIRECTORY=]\n  -n, --dry-run                Run command in dry run mode to see what would be done\n  -g, --gc \u003cGIT_COMPRESS\u003e      Git compress to reduce size of .cargo (git command required) [possible values: aggressive-checkout, aggressive-db, aggressive-index, checkout, db, index]\n  -i, --ignore \u003cIGNORE\u003e        Extra list of ignore file name which should be ignored for current command [env: TRIM_IGNORE=]\n  -l, --light                  Light cleanup without removing files required for future compilation without internet\n      --no-scan-hidden-folder  Do not scan hidden folder for current command. Takes precedence over scan-hidden-folder [env: TRIM_NOT_SCAN_HIDDEN_FOLDER=]\n      --no-scan-target-folder  Do not scan target folder for current command. Takes precedence over scan-target-folder [env: TRIM_NOT_SCAN_TARGET_FOLDER=]\n  -o, --old                    Clean old cache crates\n  -z, --old-orphan             Clean crates which are both old and orphan\n  -x, --orphan                 Clean orphan cache crates i.e all crates which are not present in lock file generated till now\n  -q, --query                  Return size of different .cargo/cache folders\n      --scan-hidden-folder     Scan hidden folder for current command [env: TRIM_SCAN_HIDDEN_FOLDER=]\n      --scan-target-folder     Scan target folder for current command [env: TRIM_SCAN_TARGET_FOLDER=]\n  -t, --top \u003cTOP\u003e              Show certain number of top crates which have highest size\n  -u, --update                 Update Cargo.lock file present inside config directory folder path\n  -w, --wipe \u003cWIPE\u003e            Wipe folder [possible values: git, checkouts, db, registry, cache, index, index-cache, src]\n  -h, --help                   Print help\n  -V, --version                Print version\n```\n\n### Configuration\n\n`cargo-trim` stores its configuration in a cargo_trim_config.toml file, located in the OS's default config directory.\nThe file contains various settings for scanning projects and managing crates.\n\nTo find the configuration file's location, use:\n```\ncargo trim config --location\n```\nHere are some configuration options and their default values:\n\n#### 1. directory\n\n**default: []**\n\n**env: TRIM_DIRECTORY**\n\nList of directory to scan for a Rust projects\n\n#### 2. **ignore_file_name**\n\n**default: []**\n\n**env: TRIM_IGNORE**\n\nList of file or directory names to ignore during scanning.\nThis is useful for excluding folders like `node_modules` or `venv` to enhance performance.\n\n#### 3. **scan_hidden_folder**\n\n**default: false**\n\n**env: TRIM_SCAN_HIDDEN_FOLDER**\n\nIndicates whether hidden folders (those starting with a dot) should be scanned.\n\n#### 4. **scan_target_folder**\n\n**default: false**\n\n**env: TRIM_SCAN_TARGET_FOLDER**\n\nIndicates whether the target folder should be scanned. The target folder name is determined by the `CARGO_BUILD_TARGET_DIR`, `CARGO_TARGET_DIR` environment variables, or defaults to `target`.\n\n[license_badge]: https://img.shields.io/github/license/iamsauravsharma/cargo-trim.svg?style=for-the-badge\n[license_link]: LICENSE\n[cratesio_badge]: https://img.shields.io/crates/v/cargo-trim.svg?style=for-the-badge\n[cratesio_link]: https://crates.io/crates/cargo-trim\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamsauravsharma%2Fcargo-trim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamsauravsharma%2Fcargo-trim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamsauravsharma%2Fcargo-trim/lists"}