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

Correct "toolchain list" command verbose option #2084

Merged
merged 1 commit into from
Oct 30, 2019

Conversation

BeniCheni
Copy link
Contributor

Correct the verbose (or v) option of toolchain list to display full path of toolchains. Updated tests.

current observation - only displays user's rustup directory
→ rustup toolchain list -v                                                     
stable-x86_64-apple-darwin (default)	/Users/bchen/.rustup
nightly-2019-09-25-x86_64-apple-darwin	/Users/bchen/.rustup
nightly-x86_64-apple-darwin	/Users/bchen/.rustup
fixed version
→ rustup toolchain list -v                     
stable-x86_64-apple-darwin (default)	/Users/bchen/.rustup/toolchains/stable-x86_64-apple-darwin/
nightly-2019-09-25-x86_64-apple-darwin	/Users/bchen/.rustup/toolchains/nightly-2019-09-25-x86_64-apple-darwin/
nightly-x86_64-apple-darwin	/Users/bchen/.rustup/toolchains/nightly-x86_64-apple-darwin/

@kinnison
Copy link
Contributor

You have some strange indentation which needs fixing in your test.

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

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

Not bad at all for a first pass. Please simplify as directed and undo one of your changes, and ensure that the code is properly formatted so it passes the CI.

This is a distinct improvement in output.

src/cli/common.rs Outdated Show resolved Hide resolved
src/cli/rustup_mode.rs Outdated Show resolved Hide resolved
tests/cli-v1.rs Outdated Show resolved Hide resolved
tests/cli-v2.rs Outdated Show resolved Hide resolved
@BeniCheni BeniCheni force-pushed the correct-toolchain-list-verbose branch 2 times, most recently from e1a6837 to 5b75969 Compare October 28, 2019 01:19
@BeniCheni
Copy link
Contributor Author

BeniCheni commented Oct 28, 2019

Rather than adding an extra function for the delimiter?

I'd rather leave the expansion of m.is_present("verbose") to within a local toolchain_list()

The -v/--verbose thing doesn't really need checking here, pick one and test that, no need for both.

@kinnison, updated per suggestions, ready for your next convenience to review again. Thanks!

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

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

This is looking very good, but I had an idea about linked toolchains (see comments)

src/cli/common.rs Outdated Show resolved Hide resolved
src/cli/common.rs Outdated Show resolved Hide resolved
@BeniCheni BeniCheni force-pushed the correct-toolchain-list-verbose branch from 5b75969 to f8f8f21 Compare October 30, 2019 03:47
@BeniCheni
Copy link
Contributor Author

BeniCheni commented Oct 30, 2019

It might be cute to also handle symlinked toolchains (rustup toolchain link) by reading the symlink and reporting the target rather than the location in ~/.rustup/toolchains

I'd prefer if this function took toolchain as &str even though in theory it's the only consumer of the String produced in the calling function -- just to futureproof things a little.

Greeting, @kinnison! Sorry about the delay. Been under the "water" w. life & work in last couple of days, but now I'm back and pushed an update to the PR.

Like your suggestion of symlink a lot to take the feature further! Updated the feature & added suggested test. Also updated to use &str instead of String for the toolchain param of the print_toolchain_path function.

Ready for your next convenience to review again. Thanks!

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

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

Almost there, one little bogon to resolve...

src/cli/common.rs Outdated Show resolved Hide resolved
@BeniCheni BeniCheni force-pushed the correct-toolchain-list-verbose branch from e0b797f to 571fffb Compare October 30, 2019 16:14
@BeniCheni
Copy link
Contributor Author

Almost there, one little bogon to resolve...

@kinnison, updated to address the bogon, :) Thanks.

@kinnison kinnison merged commit e44868f into rust-lang:master Oct 30, 2019
@BeniCheni BeniCheni deleted the correct-toolchain-list-verbose branch October 30, 2019 19:35
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.

2 participants