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

Add option to configure cargo doc arguments #2

Open
srid opened this issue Aug 14, 2023 · 2 comments · May be fixed by #3
Open

Add option to configure cargo doc arguments #2

srid opened this issue Aug 14, 2023 · 2 comments · May be fixed by #3
Labels
good first issue Good for newcomers

Comments

@srid
Copy link
Owner

srid commented Aug 14, 2023

${cargo} doc --document-private-items --all-features

Instead of hardcoding --document-private-items --all-features, allow the user to specify them as module options. Eg.:

{
  cargo-doc-live = {
    cargo-doc-args = "--document-private-items --all-features";
  };
}
@srid srid added the good first issue Good for newcomers label Aug 14, 2023
@srid
Copy link
Owner Author

srid commented Aug 14, 2023

To implement this, simply look at how we defined the crateName option:

crateName = mkOption {
type = types.str;
description = "The crate to use when opening docs in browser";
default = builtins.replaceStrings [ "-" ] [ "_" ]
((lib.trivial.importTOML (self + /Cargo.toml)).package.name);
defaultText = "The crate name is derived from the Cargo.toml file";
};

@srid srid changed the title Add options to configure cargo doc arguments Add option to configure cargo doc arguments Aug 14, 2023
@srid
Copy link
Owner Author

srid commented Aug 14, 2023

Looks like we can avoid this option entirely by adding this to Cargo.toml?

[package.metadata.docs.rs]
all-features = true
cargo-args = ["--document-private-items"]

https://docs.rs/about/metadata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant