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

Generate documentation for raw Command attributes from builder setters #5639

Open
heaths opened this issue Aug 9, 2024 · 3 comments
Open
Labels
A-docs Area: documentation, including docs.rs, readme, examples, etc... E-medium Call for participation: Experience needed to fix: Medium / intermediate

Comments

@heaths
Copy link

heaths commented Aug 9, 2024

Generate documentation for raw attributes from Command builder setter methods. These should not conflict with magic attributes with the same name: those should take precedent. This may help improve discoverability for those reading the higher-level tutorial/docs, but will generate a lot of content. Perhaps each attribute's documentation should generate a separate page that can be #[doc = include_str!(...)] on the member.

Kind of an out-there idea is we could create a cargo xtask to use rustdoc json output (nightly only) to extract all of the builder methods that may be used as an attribute and inject that into the reference, linking to the builder methods. This would improve discoverability but wouldn't help with providing derive-specific examples. We'd also have to deal with the overlap between magic attributes that also have a builder method.

Originally posted by @epage in #4090 (comment)

@epage
Copy link
Member

epage commented Aug 9, 2024

In a reply to that post

Right now, I'm leaning towards a bullet list of all raw attributes for a type in a format similar to magic attributes (<name> = <something> when single argument, <name>(<something>) for multi-argument). <name> would link to the builder method and <something> can use the arg name but link to the arg type.

The list will be big, Keeping our flat derive ref will likely be a no-go. Having a page for raw attributes will be bad for searching. We likely will need a page per attribute type with magic and then raw attributes. We can use #[doc(path)] to pull in the generated pages.

@epage epage added A-docs Area: documentation, including docs.rs, readme, examples, etc... E-medium Call for participation: Experience needed to fix: Medium / intermediate labels Aug 9, 2024
@epage
Copy link
Member

epage commented Aug 9, 2024

Now that I'm not on mobile, a rough idea of what this could look like

  • styles = <styles: Styles>: Sets the Styles for terminal output (see Command::styles for more details)
    • Available on crate feature color only.

@epage
Copy link
Member

epage commented Aug 9, 2024

If we re-organize the docs to fit in this new content, please make that a separate commit from creating the new documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation, including docs.rs, readme, examples, etc... E-medium Call for participation: Experience needed to fix: Medium / intermediate
Projects
None yet
Development

No branches or pull requests

2 participants