rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Add dynamic completions for target names in `rustup target` sub-command

Open FranciscoTGouveia opened this issue 3 months ago • 9 comments

Currently, rustup target add does not support completions for target names.

We should use clap's dynamic completions for this, possibly extending them to other subcommands (see #2268).

FranciscoTGouveia avatar Aug 24 '26 11:08 FranciscoTGouveia

I am interested with this as well, maybe we can do this together? @FranciscoTGouveia

Cloud0310 avatar Aug 24 '26 12:08 Cloud0310

@Cloud0310 I think it'd be cool if you can attack #2268 and @FranciscoTGouveia on rustup target *. There will inevitably be an overlap somewhere but I believe one PR can be easily rebased on top of the other. How does that sound?

rami3l avatar Aug 24 '26 12:08 rami3l

Sounds good to me, I will try to fix the part that I am interested: dynamic completion is not been enabled in rustup, causing command like rustup component <Tab>'s completion is wrong.

Cloud0310 avatar Aug 24 '26 15:08 Cloud0310

@FranciscoTGouveia Just for the heads up: we have added the basics of dynamic completion in https://github.com/rust-lang/rustup/pull/5033.

rami3l avatar Aug 26 '26 09:08 rami3l

Here's more context, you should see the limitation from clap. I suggest once @FranciscoTGouveia is done with issue, we should add docs for this problem.

Cloud0310 avatar Aug 26 '26 14:08 Cloud0310

@FranciscoTGouveia would love to help with the dynamic target completions Are you still planning to work on this, or would you be okay with me taking it (or collaborating)?

14elias avatar Sep 25 '26 09:09 14elias

Hello @14elias! Thanks for the message. Yes, you can take it. I currently have quite a lot of university work on my plate. If you want to discuss anything please feel free to ping me :)

FranciscoTGouveia avatar Sep 25 '26 12:09 FranciscoTGouveia

I believe this can also be extended to other sub-commands, namely rustup target remove. Would it make sense for me to start working on a PR for that, @rami3l ?

FranciscoTGouveia avatar Oct 11 '26 18:10 FranciscoTGouveia

@FranciscoTGouveia Yup, please feel free to claim it :)

rami3l avatar Oct 11 '26 18:10 rami3l