Feature Request: A way to backup/restore cargo install'd crates
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Describe the problem you are trying to solve
I use cargo to install some system utilities on my machine. I generally like to back up the installed packages + flags I used to install them to a file that I can use to restore those packages onto new machines. For example, on OS X, brew-bundle supports this, letting you run brew bundle dump to output a file that can be read via brew bundle later to restore this set of installed packages.
Cargo tracks installed crates via the ~/.cargo/.crates.toml file. This seems to be the same file that is read when you run cargo install --list.
Describe the solution you'd like
I'd like to see a cargo install --dump or similar that would output the list of installed crates to stdout, but rather than in a human-readable format, in a json/toml/other structured format.
The companion command would be something like cargo install --dump /path/to/dumpfile.toml, which would cargo install all listed crates with all of their options.
Notes
If this is a desirable feature, I'd be happy to submit a PR adding this functionality.
Thanks in advance for any thoughts!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining Cargo's handling of ~/.cargo/.crates.toml and the existing cargo install --list entry point. Define how a structured dump represents installed crates and the flags needed for restoration, then verify that the proposed dump and restore flows preserve those options and reproduce the listed installations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100