Open kevinmost opened 5 years ago
I would definitely be interested in this.
+1 on this idea.
We could probably reuse .crates2.json
file. InstallInfo
struct should contain sufficient information for us to reinstall.
(Maybe source replacement and patch
are not included but that should be fine I guess?).
Some things need to figure out
--restore-from <PATH>
?.crates2.json
. Do we really need a new flag --dump
? rustc
version in InstallInfo
. Should we warn user if their rust version is not compatible?Otherwise the implementation should be straightforward I guess, though I didn't dive deep much.
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 viabrew 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 runcargo 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 wouldcargo 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!