Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing flags to cargo #119

Closed
elichai opened this issue Dec 1, 2019 · 15 comments
Closed

Passing flags to cargo #119

elichai opened this issue Dec 1, 2019 · 15 comments

Comments

@elichai
Copy link

elichai commented Dec 1, 2019

Hi,
I'm trying to pass flags to cargo when using this crate but it doesn't seem to register.
i.e:
cargo install-update --all -- --target x86_64-unknown-linux-gnu --verbose
looks regular and doesn't pass the verbose flag to cargo

@nabijaczleweli
Copy link
Owner

This invocation will update all packages as well as --target, x86_64-unknown-linux-gnu, and --verbose.

cargo-update has never supported directly forwarding arbitrary cargo install options, but there's some per-package config.

That being said, I can see the value in that forwarding, especially since cargo install doesn't seem to support slurping flags from the environment.

@elichai
Copy link
Author

elichai commented Dec 1, 2019

I would really like that. I have a nice bash script that automatically changes every cargo install invocation into RUSTFLAGS+=' -Clto -Ctarget-cpu=native' command cargo install "$@" --target x86_64-unknown-linux-gnu
so that the installs are with LTO and special instructions(SSE/AVX etc), but this isn't possible with cargo-update

@nabijaczleweli
Copy link
Owner

nabijaczleweli commented Dec 1, 2019

In this case I'd much rather take the arguments to forward like CARGO_INSTALL_OPTS='--target x86_64-unknown-linux-gnu --verbose' cargo install-update, but I'm assuming this works for you just as well?

@elichai
Copy link
Author

elichai commented Dec 1, 2019

Nope, just tried CARGO_INSTALL_OPTS='--target x86_64-unknown-linux-gnu --verbose' cargo install-update --all and the output isn't verbose

@nabijaczleweli
Copy link
Owner

nabijaczleweli commented Dec 1, 2019

Well, yes, I've yet to finish the patch, I was asking more from a usage standpoint, I guess

@elichai
Copy link
Author

elichai commented Dec 1, 2019

ohh yeah. that works for me. but I do think it's more idiomatic to use
command --command-flag -- --inner-command-flag

@nabijaczleweli
Copy link
Owner

In the general case I'd agree. but we already take a [PACKAGE]... argument, for which clap handles the --, so that's kinda the more expected behaviour as this stands.

@nabijaczleweli
Copy link
Owner

Can you test with 9d5a73d from master?

@elichai
Copy link
Author

elichai commented Dec 1, 2019

will do

@elichai
Copy link
Author

elichai commented Dec 1, 2019

error: failed to compile `cargo-update v2.3.1 (/home/elichai2/gits/cargo-update)`, intermediate artifacts can be found at `/home/elichai2/gits/cargo-update/target`

Caused by:
  failed to resolve patches for `https://github.com/rust-lang/crates.io-index`

Caused by:
  patch for `unicode-normalization` in `https://github.com/rust-lang/crates.io-index` resolved to more than one candidate

@nabijaczleweli
Copy link
Owner

Yes, that's a work in progress, but you should be able to git reset --hard 9d5a73dcd60136b524421343090fb87e0eaf5d94 in the mean-time

@elichai
Copy link
Author

elichai commented Dec 1, 2019

you should do unicode-normalization = "=0.1.9" if they broke stuff.
it works a lot better than patching

nabijaczleweli added a commit that referenced this issue Dec 1, 2019
@nabijaczleweli
Copy link
Owner

That worked, thank you!

@elichai
Copy link
Author

elichai commented Dec 1, 2019

it seems to work but I have a separate problem with cargo itself
anyway, I'll update my bash script to also set CARGO_INSTALL_OPTS and i'll wait for a release :)

@nabijaczleweli
Copy link
Owner

Released in v2.4.0!

nabijaczleweli added a commit that referenced this issue Jul 29, 2020
Error handling's dogshit, but we don't expect any errors, so panicking
with info's fine, so meh

Ref: #119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants