Gankra / cargo-mommy

Mommy's here to support you when running cargo~
https://faultlore.com/cargo-mommy/
Apache License 2.0
726 stars 49 forks source link

standalone "mommy" binary? #65

Open Gankra opened 9 months ago

Gankra commented 9 months ago

Many people have asked, it might be reasonable to have the cargo-mommy package include two binaries: cargo-mommy (the current one) and mommy (a new one). The mommy binary would behave more like time or whatever, in that it would execute all the arguments that follow, without any notion of "re-invoking cargo". cargo mommy check would be basically equivalent to mommy cargo check, i think.

If we want to do this, the bulk of main.rs should be hoisted into a new lib.rs, as both binaries would share most logic.

They would basically differ in the cli logic in main.rs:

https://github.com/Gankra/cargo-mommy/blob/0ec17361d8b0573d0155984403e576b788abeb60/src/main.rs#L45-L168

Beyley commented 9 months ago

Ideally this separate binary would have the optional ability to just take in a process exit code number and use that directly, its possible already using CARGO_MOMMYS_ACTUAL=bash cargo-mommy -c "exit $?" in a zsh precmd hook to integrate it with my shell, but it feels like quite a hack, it'd be nice if i could just pass cargo mommy the $? exit code directly and have it react on that, since then there isnt the overhead of spinning up bash and running exit and all

Zopolis4 commented 9 months ago

That's how FWDekker/mommy does it, and that works quite well especially for shell integration.