cargo-husky icon indicating copy to clipboard operation
cargo-husky copied to clipboard

Improve documentation: how to apply feature changes

Open sbeyer opened this issue 3 years ago • 3 comments

For cargo-husky users that are new to Rust and the cargo system, it might be unclear how to let updated cargo-husky feature changes in Cargo.toml also update the Git hooks.

For example, perform the following steps:

  1. add
    [dev-dependencies.cargo-husky]
    version = "1"
    features = ["precommit-hook", "run-cargo-clippy"]
    
    to Cargo.toml
  2. invoke cargo test
  3. notice that .git/hooks/pre-commit contains cargo clippy :+1:
  4. add "run-cargo-fmt" to the features in Cargo.toml
  5. invoke cargo test
  6. notice that .git/hooks/pre-commit does not contain cargo fmt :-1:

My request is to update the README.md to make clear how to "activate" changed feature settings.

sbeyer avatar May 23 '21 00:05 sbeyer

I was just going to report this, do you know how to do it?

xenoterracide avatar Jun 07 '21 17:06 xenoterracide

I was just going to report this, do you know how to do it?

Other than cargo clean? No.

sbeyer avatar Jun 07 '21 22:06 sbeyer

hmm... I have this in the root Cargo.toml

[dev-dependencies.cargo-husky]
version = "^1"
default-features = false # Disable features which are enabled by default
features = ["precommit-hook", "run-cargo-fmt", "run-for-all"]
❯ cargo clean                                                                                                                     # brix-rust -> ccushing/copy-1a ! $
❯ cargo test    
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
❯ cat .git/hooks/pre-commit                                                                                                         # brix-rust -> ccushing/copy-1a ! $
[bat error]: '.git/hooks/pre-commit': No such file or directory (os error 2)

xenoterracide avatar Jun 13 '21 22:06 xenoterracide