mainmatter / cargo-autoinherit

(Auto)DRY for your Rust dependencies
Apache License 2.0
130 stars 8 forks source link

implement basic check flag #17

Open azdle opened 6 months ago

azdle commented 6 months ago

This implements a very basic version of a check flag. If any dependencies that should move to the workspace are found, they are printed to stderr and the command exits with a FAILURE ExitCode.

If any dependencies are found in a workspace member, but that have an existing workspace dependency that can be directly used (that is if the workspace Cargo.toml doesn't need to be modified) nothing is printed, but the command still exits with FAILURE.

Ideally the check flag would work like cargo fmt --check where a diff is shown, but that would require extensive refactoring.


Not sure if you'll be okay with ^ limitations. If not I may be able to find some time in the future to try making proper diffs possible, not sure.

Also, I've added ExitCode as the return from auto_inherit in lib.rs. That's more of a command specific thing, but I thought it would be good to differentiate between "failed to run the command" and "the command ran successfully, but indicated failure". I can make it something else if you find using std::process::ExitCode for that too gross.

resolves #2

hdoordt commented 16 hours ago

I rebased on main just now