matthiaskrgr / matthiaskrgr/cargo-cache

clean-unref: documentation & feat suggestion (recursivity)

Open
#116 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Rust
Stars
994
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Hi!

About documentation
cargo cache -h
...
    clean-unref    remove crates that are not referenced in a Cargo.toml from the cache

When I read this I guess that it looks around for Cargo.toml to list all the dependencies and remove data in the cache that are not used by any of them. In the README is mentioned:

  • purge cache entries not unused to build a specified crate (cargo cache clean-unref)

Then I understand that it does this only for the crate I am in. When I run the command, from my home directory, I get:

% cargo cache clean-unref
...
Failed to Cargo.toml manifest in /home/***** or downwards.

So I think the help description for this subcommand could be improved (for instance copying the README)

The suggestion

This feature as I currently understand it removes unused crates (but not binaries) that are not listed in the Cargo.toml of the crate I am currently in, therefore ignoring all the other crates. I think it can be good for CI use, but for personal use, I think that it could be interesting to have a command like clean-unref-user which (Rust-like pseudocode):

  • let used = Iterates over all Cargo.toml in user directory recursively (can take some time)
  • .map(|file| file. get the list of the dependencies ()).flatten();
  • Get the list of the repositories
  • for dependency in used { remove dependency from the list of repositories (skip if already removed or missing) }
  • The remaining repositories are not used so can be deleted.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cargo cache -h output, the README description of clean-unref, and the command's behavior from a crate directory versus the home directory. Decide whether the work is limited to clarifying documentation or includes recursive discovery of user Cargo.toml files. Done requires a defined scope and help text that accurately describes the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.