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

Open documentation for a given crate #3805

Closed
kornelski opened this issue Mar 8, 2017 · 7 comments
Closed

Open documentation for a given crate #3805

kornelski opened this issue Mar 8, 2017 · 7 comments

Comments

@kornelski
Copy link
Contributor

kornelski commented Mar 8, 2017

I often want to see documentation for a dependency (including build dependencies), but it's cumbersome to open it — I have to go to crates.io, find the dependency, and then follow its Documentation link.

Cargo already knows this link from metadata, so it could open the documentation for me.

I'd expect it to work like this:

cargo doc crate-name

Such functionality is in npm npm docs package-name.

@steveklabnik
Copy link
Member

I have to go to crates.io, find the dependency, and then follow its Documentation link.

Doesn't cargo doc already document dependencies? so it should be cargo doc --open, click the link on the left hand sidebar.

@kornelski
Copy link
Contributor Author

kornelski commented Mar 8, 2017

  1. It doesn't do that for build dependencies.
  2. I'm hoping for documentation link to provide more than that (i.e. a tutorial, prose, examples). I don't like rustdoc output, because it has very low signal to noise ratio (no logical order, everything exposed at once, unintelligible dump of all trait's methods)

@steveklabnik
Copy link
Member

It doesn't do that for build dependencies.

Ah, this sounds like a bug, then, and probably what this ticket should focus on.

I'm hoping for documentation link to provide more than that (i.e. a tutorial, prose, examples)

This is covered by #739

@kornelski
Copy link
Contributor Author

I assume it's intentional, since build and dev dependencies are not part of crate's interface.

I would not like build/dev dependencies included in cargo doc output if I were to publish it on a website for others, since the extra dependencies would be a distraction. I only need to consume, not publish their docs.

@alexcrichton
Copy link
Member

Yes it's intentional that build-dependencies don't show up in Cargo by default, but I think this works?

cargo doc -p gcc --open

Does that work for your use case?

@kornelski
Copy link
Contributor Author

kornelski commented Mar 8, 2017

Thanks! That works. I did not notice that in the help file, because I looked for "crate" and glossed over SPEC.

@prasannavl
Copy link

prasannavl commented Oct 3, 2018

Does the linked source code work with this method though? The last I checked, it doesn't. Clicking src just leads me an empty page. Perhaps, that has to be created as a separate issue?

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

No branches or pull requests

4 participants