Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Resolves: #718
  • Loading branch information
Jake-Shadle committed Nov 15, 2024
1 parent 11b0af8 commit f6f2a00
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 21 deletions.
4 changes: 4 additions & 0 deletions docs/src/checks/cfg.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ If set, and `--features` is not specified on the cmd line, these features will b

If set to `true`, all `dev-dependencies`, even one for workspace crates, are not included in the crate graph used for any of the checks. This option can also be enabled on cmd line with `--exclude-dev` either [before](../cli/common.md#--exclude-dev) or [after](../cli/check.md#--exclude-dev) the `check` subcommand.

### The `exclude-unpublished` field (optional)

If set to `true`, workspace crates marked as `publish = false` will not be used as roots in the dependency graph, meaning they, and any dependencies they have that aren't directly or indirectly referenced by workspace crates that _are_ published, will be excluded from the dependency graph that checks are executed against.

## The `output` field (optional)

### The `feature-depth` field (optional)
Expand Down
29 changes: 27 additions & 2 deletions docs/src/cli/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,31 @@ Possible values:

One or more platforms to filter crates with. If a dependency is target specific, it will be ignored if it does not match at least 1 of the specified targets. This overrides the top-level [`targets = []`](../checks/cfg.md) configuration value.

### `--offline`
### `--exclude-unpublished`

Disables network I/O.
If set, exclude unpublished workspace members from graph roots.

Workspace members are considered unpublished if they they are explicitly marked with `publish = false`. Note that the excluded workspace members are still used for the initial dependency resolution by cargo, which might affect the exact version of used dependencies.

### `--allow-git-index`

If set, the crates.io git index is initialized for use in fetching crate information, otherwise it is enabled only if using a cargo < 1.70.0 without the sparse protocol enabled

### [`--locked`](https://doc.rust-lang.org/cargo/commands/cargo-fetch.html#option-cargo-fetch---locked)

Asserts that the exact same dependencies and versions are used as when the existing Cargo.lock file was originally generated. Cargo will exit with an error when either of the following scenarios arises:

* The lock file is missing.
* Cargo attempted to change the lock file due to a different dependency resolution.

### [`--offline`](https://doc.rust-lang.org/cargo/commands/cargo-fetch.html#option-cargo-fetch---offline)

Prevents Cargo and `cargo-deny` from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.

Beware that this may result in different dependency resolution than online mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline.

`cargo-deny` will also not fetch advisory databases with this option, meaning that any new or updated advisories since the last time the database(s) were fetched won't be known and thus won't be checked against the dependency graph.

### [`--frozen`](https://doc.rust-lang.org/cargo/commands/cargo-fetch.html#option-cargo-fetch---frozen)

Equivalent to specifying both `--locked` and `--offline`.
14 changes: 7 additions & 7 deletions docs/src/cli/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Similarly to [cargo-license](https://github.com/onur/cargo-license), `list` prin

## Options

### `-c, --config <CONFIG>`

Path to the config to use

Defaults to `<cwd>/deny.toml` if not specified

### `-f, --format`

The format of the output
Expand All @@ -12,13 +18,7 @@ The format of the output
* `json`
* `tsv`

### `--color`

Output coloring, only applies to the `human` format.

* `auto` (default) - Only colors if stdout is a TTY
* `always` - Always emits colors
* `never` - Never emits colors
### [`--color`](../cli/common.md#--color)

Colors:

Expand Down
15 changes: 8 additions & 7 deletions src/cargo-deny/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,31 @@ pub(crate) struct GraphContext {
/// Space or comma separated list of features to activate
#[arg(long, value_delimiter = ',')]
pub(crate) features: Vec<String>,
/// Require Cargo.lock and cache are up to date
/// Equivalent to specifying both `--locked` and `--offline`
#[arg(long)]
pub(crate) frozen: bool,
/// Require Cargo.lock is up to date
#[arg(long)]
pub(crate) locked: bool,
/// Run without accessing the network.
///
/// If used with the `check` subcommand, this disables advisory database
/// fetching
#[arg(long)]
pub(crate) offline: bool,
/// Assert that `Cargo.lock` will remain unchanged
#[arg(long)]
pub(crate) locked: bool,
/// If set, the crates.io git index is initialized for use in fetching crate information, otherwise it is enabled
/// only if using a cargo < 1.70.0 without the sparse protocol enabled
#[arg(long)]
pub(crate) allow_git_index: bool,
#[arg(long)]
/// If set, excludes all dev-dependencies, not just ones for non-workspace crates
pub(crate) exclude_dev: bool,
#[arg(long)]
pub(crate) exclude_dev: bool,
/// If set, exclude unpublished workspace members from graph roots.
/// Workspace members are considered unpublished if they they are explicitly marked with `publish = false` as such.
///
/// Workspace members are considered unpublished if they they are explicitly marked with `publish = false`.
/// Note that the excluded workspace members are still used for the initial dependency resolution by cargo,
/// which might affect the exact version of used dependencies.
#[arg(long)]
pub(crate) exclude_unpublished: bool,
}

Expand Down
13 changes: 8 additions & 5 deletions tests/snapshots/cargo_deny__test__cargo_deny.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cargo-deny/main.rs
expression: help_text
snapshot_kind: text
---
Cargo plugin to help you manage large dependency graphs

Expand Down Expand Up @@ -73,24 +74,26 @@ Options:
Space or comma separated list of features to activate

--frozen
Require Cargo.lock and cache are up to date

--locked
Require Cargo.lock is up to date
Equivalent to specifying both `--locked` and `--offline`

--offline
Run without accessing the network.

If used with the `check` subcommand, this disables advisory database fetching

--locked
Assert that `Cargo.lock` will remain unchanged

--allow-git-index
If set, the crates.io git index is initialized for use in fetching crate information, otherwise it is enabled only if using a cargo < 1.70.0 without the sparse protocol enabled

--exclude-dev
If set, excludes all dev-dependencies, not just ones for non-workspace crates

--exclude-unpublished
If set, exclude unpublished workspace members from graph roots. Workspace members are considered unpublished if they they are explicitly marked with `publish = false` as such. Note that the excluded workspace members are still used for the initial dependency resolution by cargo, which might affect the exact version of used dependencies
If set, exclude unpublished workspace members from graph roots.

Workspace members are considered unpublished if they they are explicitly marked with `publish = false`. Note that the excluded workspace members are still used for the initial dependency resolution by cargo, which might affect the exact version of used dependencies.

-h, --help
Print help (see a summary with '-h')
Expand Down

0 comments on commit f6f2a00

Please sign in to comment.