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

cargo run --{example,bin,bench,test} tab completion #8871

Closed
pbrw opened this issue Nov 18, 2020 · 5 comments
Closed

cargo run --{example,bin,bench,test} tab completion #8871

pbrw opened this issue Nov 18, 2020 · 5 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@pbrw
Copy link

pbrw commented Nov 18, 2020

Problem
If you want to run an example, you have to write it's full name in cargo run --example <example_name>. Name may be long and time is precious.

Solution
It would be great to have a tab completion implemented. We already have a list of possible targets displayed (#6505).

Notes
This was already mentioned here

@pbrw pbrw added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Nov 18, 2020
@ehuss
Copy link
Contributor

ehuss commented Nov 23, 2020

It should already work, at least with bash. The source is here. Which shell are you using?

The existing implementation is a bit of a hack, so perhaps it doesn't work in some situations. Quickly retrieving the target names is not currently possible. The long-term solution is intended to be #6645 where the cargo binary itself would drive the completions, where it has easy access to all the information.

@pbrw
Copy link
Author

pbrw commented Nov 29, 2020

I use GNOME Terminal 3.36.2 and it clearly doesn't work

@ehuss
Copy link
Contributor

ehuss commented Nov 29, 2020

GNOME Terminal is a GUI terminal program which is the interface to the underlying shell. The shell is something like bash, zsh, or fish. Each shell has different shell completion, so it is important to know which one you are using, and to check that the completions are integrated properly. The exact method of integration will depend on the shell, OS, and how your startup scripts are setup. Do any of the completions work? If not, then maybe check that the completion is linked in properly for your environment. If completions are working, but just not the --example flag, can you provide a sample project that demonstrates where it doesn't work?

@pickfire
Copy link
Contributor

pickfire commented Dec 21, 2020

Yeah, I am wondering why cargo does not auto complete --example for fish shell.

@pickfire
Copy link
Contributor

Ah, looks like it was in fish but there was a bug probably, or maybe it was new. fish-shell/fish-shell#7566

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

4 participants