Goods, kinda like npm for cargo


This is goods, a small CLI tool to add dependencies to a Cargo.toml automatically, kinda like npm.
You can install it by running (sudo) npm i -g goods and then running gds install cargopackage in a directory where a Cargo file is present. Goods automatically checks if the crate even exists by looking through the GitHub index.

That being said, the project is at its very start, so if you have suggestions of any kind or maybe improvements, post them here or create a PR on GitHub!


I really like the idea, thuogh it would be nice if this sort of thing was built into Cargo itself, reducing the extra dependency.


I you want this to get any use, you’ll want to rewrite it in Rust and make it a cargo subcommand.


@darthdeus @birkenfeld Makes sense, but I don’t think my Rust is good enough to properly fabricate something there. (Which is why I wrote it in Node ;))


It shouldn’t be too difficult, given that Cargo already knows how to handle .toml files. You wouldn’t have to write much code, probably just plug in at the right places.


There’s this though!


AFAIK, it doesn’t have to be written in rust to be a cargo subcommand-- if it has a binary named “cargo-something” and you have it installed in your $PATH, you can then run it as if it were a cargo subcommand, that is, with cargo something.

This is documented on the cargo wiki :smile:


I realize that, but I for one wouldn’t want to have to install node.js just to get something that’s supposed to be part of the Rust ecosystem.


That’s your choice, of course. I just wanted to point out that it wasn’t a technical limitation of the cargo subcommand system :smile:


If you have the time and skills, you’re free to replicate the functionality within Rust, of course!


Well, this doesn’t look too complicated, so it could also be a nice project to get deeper into Rust for you :slight_smile:


That’s actually not too bad of an idea!


It would be nice to have a flag to cargo install subcommand, like cargo install --save.


It would be nice to have a flag to cargo install subcommand, like cargo install --save. @kstep

This is exactly what I was going to suggest. That matches the behavior of npm install --save (and likewise with other, similar tools). You might also think about using the Cargo manifest’s [dev-dependencies] section to do something like what you can do with npm install --save-dev.


That’s exactly what was on my mind too.