-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo doc: add option to document only public items for binary crates #7963
Comments
Fixes rust-lang#7963. Previously, --document-private-items was only a 'truthy' flag, and was enabled in rust-lang#7593 for binary targets by default. However, this prevented any means of *disabling* this functionality for binary targets, hence rust-lang#7963. This change does a few things. It first adds a new argument parser type called `yesno_flag()` that is a wrapper around a few `clap::Arg` settings to use the built-in `BoolishValueParser` in a way that allows for the `--flag` to return `true`, as well as an optional `=no` or `=yes` (or `=1`, `=off`, etc.) to explicitly set it to `true` or `false`. Then, the internal field for passing the private member documentation flag to rustdoc was changed to an `Option<bool>` to treat `None` as the automatic project type detection, and a `Some` value to override the behavior outright. This change should be entirely backwards compatible.
Fixes rust-lang#7963. Previously, --document-private-items was only a 'truthy' flag, and was enabled in rust-lang#7593 for binary targets by default. However, this prevented any means of *disabling* this functionality for binary targets, hence rust-lang#7963. This change does a few things. It first adds a new argument parser type called `yesno_flag()` that is a wrapper around a few `clap::Arg` settings to use the built-in `BoolishValueParser` in a way that allows for the `--flag` to return `true`, as well as an optional `=no` or `=yes` (or `=1`, `=off`, etc.) to explicitly set it to `true` or `false`. Then, the internal field for passing the private member documentation flag to rustdoc was changed to an `Option<bool>` to treat `None` as the automatic project type detection, and a `Some` value to override the behavior outright. This change should be entirely backwards compatible.
Took a whack at this in #10979. Hopefully that solves the need :) |
Fixes rust-lang#7963. Previously, --document-private-items was only a 'truthy' flag, and was enabled in rust-lang#7593 for binary targets by default. However, this prevented any means of *disabling* this functionality for binary targets, hence rust-lang#7963. This change does a few things. It first adds a new argument parser type called `yesno_flag()` that is a wrapper around a few `clap::Arg` settings to use the built-in `BoolishValueParser` in a way that allows for the `--flag` to return `true`, as well as an optional `=no` or `=yes` (or `=1`, `=off`, etc.) to explicitly set it to `true` or `false`. Then, the internal field for passing the private member documentation flag to rustdoc was changed to an `Option<bool>` to treat `None` as the automatic project type detection, and a `Some` value to override the behavior outright. This change should be entirely backwards compatible.
Hi, just wanted to bump this, as it's definitely still something I would find useful. Generating documentation for a binary package can be useful to someone navigating a codebase for the first time, but unfortunately, certain macros tend to leave undocumented private items all over a crate (e.g: Tracing leaves private |
Describe the problem you are trying to solve
#7593 enables
--document-private-items
flag by default for binary crates. As stated in the PR:Describe the solution you'd like
Add flag like
--document-only-public-items
which can be used for binary crates to disable flag--document-private-items
(which is enabled by default)The text was updated successfully, but these errors were encountered: