Skip to content

Include shell completion for Cargo#1425

Closed
ricvelozo wants to merge 5 commits into
rust-lang:masterfrom
ricvelozo:sh-compl
Closed

Include shell completion for Cargo#1425
ricvelozo wants to merge 5 commits into
rust-lang:masterfrom
ricvelozo:sh-compl

Conversation

@ricvelozo

@ricvelozo ricvelozo commented Jun 2, 2018

Copy link
Copy Markdown
Contributor

@Diggsey Diggsey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR! There are however a few changes needed before I'd be happy accepting it.

("completions", Some(c)) => {
if let Some(shell) = c.value_of("shell") {
let shell = shell.parse::<Shell>().unwrap();
let prefix = "~/.rustup/toolchains/$(rustup toolchain list --default)";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This prefix is not correct - rustup is not necessarily installed here, and the default toolchain isn't necessarily correct.

To get the installation directory of the active toolchain, you should use rustc --print sysroot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Does to replace the rustup toolchain list --default for rustc --print sysroot solves the problem? I have no way to know the toolchain that the user is using, just the default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Diggsey Help me to finish this, please.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

rustc --print sysroot will call the binary of the currently used toolchain.

&mut io::stdout(),
);

match shell {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-trivial logic like this should be pulled out into its own function.

.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("list").about("List installed toolchains"))
.subcommand(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change should not be necessary

@ricvelozo ricvelozo Jun 10, 2018

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are you requesting to remove the new --default arg?

Comment thread src/rustup-cli/common.rs
}

pub fn list_toolchains(cfg: &Cfg) -> Result<()> {
pub fn list_toolchains(cfg: &Cfg, m: &ArgMatches) -> Result<()> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please revert the changes to this file as they should not be necessary.

@bors

bors commented Jan 8, 2019

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #1576) made this pull request unmergeable. Please resolve the merge conflicts.

@nrc

nrc commented Jan 14, 2019

Copy link
Copy Markdown
Member

Closing due to lack of activity and reviewer bandwidth.

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.

5 participants