I'm updating a CLI app that I've build using the clap crate, but I'm encountering very strange build behavior. When I run the cargo build command to run my CLI, it does not seem to pickup the new subcommand I've made.
I have deleted the binary itself under /target/debug and tried deleting the entire /target directory. I've also cleared the build cache and run cargo clean, but nothing seems to work.
What is particularly strange is that if I run cargo run -- -h within application's root directory, it picks up the changes with my new subcommand.
cargo build (within the root of the application directory)
cd to /target/debug
my_cli -h
Separately, I will run the following within the root of the application directory:
cargo run -- -h
The former does not pickup my new subcommand, but the second one does. For some additional context, my repo is a workspace, but it is not published to cargo so dependencies within the workspace are using local paths.
My Cargo.toml is pretty vanilla besides it being part of a workspace, so I am not using features for this CLI at the moment. I'm at a loss as to what would be causing this...
What does which my_cli print? What if you run ./my_cli to ensure you are running the executable in the current directory, rather than one installed somewhere else in your $PATH?