dtolnay / request-for-implementation

Crates that don't exist, but should
613 stars 6 forks source link

Tool to streamline running public crate examples #30

Closed lgarczyn closed 4 years ago

lgarczyn commented 5 years ago

A large part of trying out new libraries (say rust-sdl2) is to clone them from their github page, and calling cargo --example on one of the listed examples.

It implies opening a browser, cloning, different folders, etc. All in all, it's a lot of work to do things that cargo knows how to do.

A cargo plugin (and maybe a feature later on) allowing to run cargo example rust-sdl2 example-n1 that would just work, without having to create then delete a whole folder, and maybe even caching large libraries, would streamline the whole process.

Simply running cargo example rust-sdl2 would list the available examples.

Some sandboxing might even be added for more safety.

BrandtM commented 5 years ago

I'm gonna give this one a shot.

dtolnay commented 5 years ago

Nice! Thanks. Drop a link to your repository here once you start putting code up, even if it's not ready to use.

BrandtM commented 5 years ago

Alright I've got the repo setup with some very basic functionality: https://github.com/BrandtM/cargo-example
For now it only uses the name of the crate you supply to clone its git repository to your CARGO_HOME/.cargo-example directory. It'll need a lot of work and I already have a bunch of ideas to make it really cool but I think the biggest roadblock will be crates.io itself.
For now you'll need to enter the specific name of the crate or the program explodes :D

BrandtM commented 5 years ago

Just to give you guys a quick update: The repo is still very much WIP but it's now usable in a state where I felt comfortable publishing it on crates.io
There's still a long road ahead but at least it's not in a totally broken development stage anymore!

dtolnay commented 5 years ago

Nice, that's terrific. I am confused by the readme (https://github.com/BrandtM/cargo-example/issues/2) but it looks like great progress! I'll let @lgarczyn make the call as to when this solves what they were looking for, and then we can close out this issue.

lgarczyn commented 5 years ago

I haven't had to time to try it out yet, but I'll do that as soon as I can

dtolnay commented 4 years ago

I am going to close this out, and @lgarczyn and others can follow up in the issue tracker of https://github.com/BrandtM/cargo-example with any further feature requests.

Thanks @BrandtM!