Skip to content

Correct "toolchain list" command verbose option#2084

Merged
kinnison merged 1 commit intorust-lang:masterfrom
BeniCheni:correct-toolchain-list-verbose
Oct 30, 2019
Merged

Correct "toolchain list" command verbose option#2084
kinnison merged 1 commit intorust-lang:masterfrom
BeniCheni:correct-toolchain-list-verbose

Conversation

@BeniCheni
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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.

@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
Copy Markdown
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
Copy Markdown
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)

@BeniCheni BeniCheni force-pushed the correct-toolchain-list-verbose branch from 5b75969 to f8f8f21 Compare October 30, 2019 03:47
@BeniCheni
Copy link
Copy Markdown
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!

@BeniCheni BeniCheni requested a review from kinnison October 30, 2019 03:59
@BeniCheni BeniCheni force-pushed the correct-toolchain-list-verbose branch from f8f8f21 to 05d3413 Compare October 30, 2019 04:26
Copy link
Copy Markdown
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...

@BeniCheni BeniCheni force-pushed the correct-toolchain-list-verbose branch from e0b797f to 571fffb Compare October 30, 2019 16:14
@BeniCheni
Copy link
Copy Markdown
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