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

Support to open more documents directly in rustup doc #1597

Merged
merged 1 commit into from
Jan 14, 2019

Conversation

king6cong
Copy link
Contributor

@king6cong king6cong commented Jan 2, 2019

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

image

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
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 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"),
];

Copy link
Contributor

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.

Copy link
Contributor Author

@king6cong king6cong Jan 6, 2019

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:

  1. 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.
  2. Help messages cannot be easily auto-generated due to different layouts of these docs
  3. I think it may not be the case that every doc needs a cargo doc shortcut
  4. This list does not tend to change very often.

So at last, I thought handpicking might be a better choice

Copy link
Contributor

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.

@nrc
Copy link
Member

nrc commented Jan 14, 2019

cc @rust-lang/rustdoc thoughts? Seems nice to have to me, but are there potential downsides?

@GuillaumeGomez
Copy link
Member

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.

@QuietMisdreavus
Copy link
Member

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.

@nrc nrc merged commit f767b8f into rust-lang:master Jan 14, 2019
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.

None yet

5 participants