-
Notifications
You must be signed in to change notification settings - Fork 884
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
Support to open more documents directly in rustup doc
#1597
Conversation
e.g. `rustup doc --nomicon` Documents supported: alloc,book,cargo,core,edition-guide,nomicon,proc_macro,reference,rust-by-example,rustc,rustdoc,std,test,unstable-book
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to support everything the old API did, but I'm not entirely convinced having that many hard-coded documentation sections is sensible.
("test", "Support code for rustc's built in unit-test and micro-benchmarking framework", "test/index.html"), | ||
("unstable-book", "The Unstable Book", "unstable-book/index.html"), | ||
]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than hard-coding this list, is there a way we can load it from the toolchain? I accept that might be hard currently since we'd have to parse a partial commandline loosely to ensure we knew which toolchain to use, and then go again once we'd loaded the docs list, but it'd mean that if new docs were added, we'd automatically pick them up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I have also considered auto-generating vs hard-coding. Actually, the flags are got by running cd ~/.rustup/toolchains/nightly-2018-12-31-x86_64-apple-darwin/share/doc/rust/html && ls */index.html | xargs -n1 echo | cut -d'/' -f1
:)
In addiction to the toolchain choosing problem, I think these should also be considered:
rust doc
flags did not always have to match up with the directory name where the docs resides, that's why the document index path isn't auto-generated by appending/index.html
to flags. This is also how things are handled at the moment.- Help messages cannot be easily auto-generated due to different layouts of these docs
- I think it may not be the case that every doc needs a
cargo doc
shortcut - This list does not tend to change very often.
So at last, I thought handpicking might be a better choice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds fair, thanks for explaining it.
cc @rust-lang/rustdoc thoughts? Seems nice to have to me, but are there potential downsides? |
The more the better I assume? The only known problem with docs is that it's very slow on windows. But beyond that, seems like a good thing to me. |
Seems more like a @rust-lang/docs thing. I'm a fan of this. We have been adding things to the bookshelf over time, but as @king6cong mentioned, it's not so often that it will create a problem. |
e.g.
rustup doc --nomicon
Documents supported:
alloc,book,cargo,core,edition-guide,nomicon,proc_macro,reference,rust-by-example,rustc,rustdoc,std,test,unstable-book