Cargo: "cargo install --target-dir" does not work

Created on 21 May 2020  路  9Comments  路  Source: rust-lang/cargo

cargo install clearly needs a target dir, and honors the CARGO_TARGET_DIR env var. But for some reason it does not accept the --target-dir flag, unlike the other commands.

Would be nice to make this consistent. :)

A-cli C-feature-request Command-install E-easy

All 9 comments

@alexcrichton mentioned in https://github.com/rust-lang/cargo/issues/4725#issuecomment-350373564 that you would prefer not to add the flag at that time. I wonder if your mind has changed on that? I don't see any particular downsides to adding it, and it would provide consistency with all the other build commands.

I believe that comment was more in reference to "let's not add a single flag for just cargo install", but now that --target-dir is everywhere except cargo install then makes sense to me to add support there.

Would like to work on this!

Great! Let us know if you have any questions.

Hello Im considering working on this issue, where exactly would this new flag be added I'm thinking it would be in the same file as https://github.com/rust-lang/cargo/pull/8344/commits/3fbd5aefd4bf47047924ce01e49106b78286146c or would there be a more suitable place ?

@AlvinKuruvilla I think @bl2e mentioned they were working on this. @bl2e are you still working on it?

Some brief instructions:

  • There is an arg_target_dir function that needs to be called in the install command.
  • Install has special consideration for the target dir, so this code will need to be updated.
  • At least one test should be added (perhaps more to test different source behavior). Tests would go in install.rs. There are some existing tests for target-dir behavior there already. More details about running and writing tests can be found in CONTRIBUTING.md and cargo-test-support.
  • The documentation needs to be updated. There is some discussion of how to update the man pages in the docs README. The help item also needs to be updated.

Yes still working on it.

Should be closed as of #8391?

Yes, thanks!

Was this page helpful?
0 / 5 - 0 ratings