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

Add completion for cargo. #1717

Closed
wants to merge 5 commits into from
Closed

Add completion for cargo. #1717

wants to merge 5 commits into from

Conversation

NariyasuHeseri
Copy link
Contributor

No description provided.

Copy link
Member

@cornfeedhobo cornfeedhobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I've left some comments for things to change.

My last question is if this is your own creation or copied from an upstream source? If you have copied it, could you please include a comment at the top of the file linking to the original source and giving them credit.

Thanks!

completion/available/cargo.completion.bash Outdated Show resolved Hide resolved
completion/available/cargo.completion.bash Outdated Show resolved Hide resolved
completion/available/cargo.completion.bash Outdated Show resolved Hide resolved
@NariyasuHeseri
Copy link
Contributor Author

ShellCheck reports SC2207 warnings but this seems to lead to cumbersome "while read line" statements to fix them.
Sould we disable SC2207 rule?

@NoahGorny
Copy link
Member

@NariyasuHeseri I am not convinced that copying completion files is the correct solution here.. seems like rust-lang/rustup#1646 caused rustup to add cargo completion. We can enhance the newly added rustup completion file to also autocomplete cargo

@NariyasuHeseri
Copy link
Contributor Author

I have finnaly figured out eval "$(rustup completions bash cargo)" can be used to add completion for cargo.
I'm going to close this PR. Thank you.

@cornfeedhobo
Copy link
Member

cornfeedhobo commented Dec 5, 2020

@NariyasuHeseri Oh good digging! If you feel like re-opening this PR, what you found would be great to codify. Something like...

if _command_exists rustup ; then
	eval "$(rustup completions bash cargo)"
fi

Otherwise I might get around to it when I start playing with rust. Thanks again!

@NariyasuHeseri
Copy link
Contributor Author

I have opened a new PR adding these lines in cargo.completion.bash (to make commit histories cleaner).

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

Successfully merging this pull request may close these issues.

3 participants