Skip to content

Add cargo doc flag or functionality to open docs at a specific crate #10516

Open
@nickgerace

Description

@nickgerace

Problem

I believe it may be useful to add a flag or functionality to choose what crate cargo doc --open opens to. For repositories with a lot of local crates, this could be useful for newcomers who want to know where to start.

A current workaround is to generate docs for all crates and then package the specific crate you want.

cargo doc --all
cargo doc -p <desired-crate> --open

However, that workaround requires circumstantial knowledge of cargo doc. Perhaps, the spirit of what this is trying to accomplish can be achieved in one cargo doc command.

Proposed Solution

I haven't dug too deep into the cargo doc codebase yet, but generally, the solution could look like the following:

cargo doc --open-at-crate <desired-crate>

Alternatively or additionally, users could specify a "default docs crate" that cargo doc --open opens to.

[package]
default_doc_crate = "<desired-crate>"

Notes

This functionality might already exist and I could be missing something! Thanks for reading and for all contributors to cargo.

Similar issue: #3805

For opening to a specific mod, see #10516

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-docS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions