Skip to content

Commit ef83de6

Browse files
committed
docs: add cargo-info subcommand and add man page
1 parent 9d164aa commit ef83de6

File tree

10 files changed

+611
-0
lines changed

10 files changed

+611
-0
lines changed

src/doc/man/cargo-info.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# cargo-info(1)
2+
3+
## NAME
4+
5+
cargo-info --- Display information about a package in the registry. Default registry is crates.io
6+
7+
## SYNOPSIS
8+
9+
`cargo info` [_options_] _spec_
10+
11+
## DESCRIPTION
12+
13+
This command displays information about a package in the registry. It fetches data from the package's Cargo.toml file
14+
and presents it in a human-readable format.
15+
16+
## OPTIONS
17+
18+
### Info Options
19+
20+
{{#options}}
21+
22+
{{#option "_spec_" }}
23+
24+
Fetch information about the specified package. The _spec_ can be a package ID, see {{man "cargo-pkgid" 1}} for the SPEC
25+
format.
26+
If the specified package is part of the current workspace, the information from the local Cargo.toml file will be
27+
displayed, and if no version is specified, it will select the appropriate version based on the Minimum Supported Rust
28+
Version (MSRV). If the `Cargo.lock` file does not exist, it will be created.
29+
30+
{{/option}}
31+
{{> options-index }}
32+
{{> options-registry }}
33+
{{/options}}
34+
35+
### Display Options
36+
37+
{{#options}}
38+
{{> options-display }}
39+
{{/options}}
40+
41+
### Manifest Options
42+
43+
{{#options}}
44+
{{> options-locked }}
45+
{{/options}}
46+
47+
{{> section-options-common }}
48+
49+
{{> section-environment }}
50+
51+
{{> section-exit-status }}
52+
53+
## EXAMPLES
54+
55+
1. Inspect the `serde` package from crates.io:
56+
57+
cargo info serde
58+
2. Inspect the `serde` package with version `1.0.0`:
59+
60+
cargo info [email protected]
61+
3. Inspect the `serde` package form the local registry:
62+
63+
cargo info serde --registry my-registry
64+
65+
## SEE ALSO
66+
67+
{{man "cargo" 1}}, {{man "cargo-search" 1}}

src/doc/man/cargo.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ available at <https://rust-lang.org>.
6262
{{man "cargo-generate-lockfile" 1}}\
6363
&nbsp;&nbsp;&nbsp;&nbsp;Generate `Cargo.lock` for a project.
6464

65+
{{man "cargo-info" 1}}\
66+
&nbsp;&nbsp;&nbsp;&nbsp;Display information about a package in the registry. Default registry is crates.io.
67+
6568
{{man "cargo-locate-project" 1}}\
6669
&nbsp;&nbsp;&nbsp;&nbsp;Print a JSON representation of a `Cargo.toml` file's location.
6770

@@ -241,4 +244,5 @@ stable yet and may be subject to change.
241244
See <https://github.com/rust-lang/cargo/issues> for issues.
242245

243246
## SEE ALSO
247+
244248
{{man "rustc" 1}}, {{man "rustdoc" 1}}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
CARGO-INFO(1)
2+
3+
NAME
4+
cargo-info — Display information about a package in the registry.
5+
Default registry is crates.io
6+
7+
SYNOPSIS
8+
cargo info [options] spec
9+
10+
DESCRIPTION
11+
This command displays information about a package in the registry. It
12+
fetches data from the package’s Cargo.toml file and presents it in a
13+
human-readable format.
14+
15+
OPTIONS
16+
Info Options
17+
spec
18+
Fetch information about the specified package. The spec can be a
19+
package ID, see cargo-pkgid(1) for the SPEC format. If the specified
20+
package is part of the current workspace, the information from the
21+
local Cargo.toml file will be displayed, and if no version is
22+
specified, it will select the appropriate version based on the
23+
Minimum Supported Rust Version (MSRV). If the Cargo.lock file does
24+
not exist, it will be created.
25+
26+
--index index
27+
The URL of the registry index to use.
28+
29+
--registry registry
30+
Name of the registry to use. Registry names are defined in Cargo
31+
config files
32+
<https://doc.rust-lang.org/cargo/reference/config.html>. If not
33+
specified, the default registry is used, which is defined by the
34+
registry.default config key which defaults to crates-io.
35+
36+
Display Options
37+
-v, --verbose
38+
Use verbose output. May be specified twice for “very verbose”
39+
output which includes extra output such as dependency warnings and
40+
build script output. May also be specified with the term.verbose
41+
config value
42+
<https://doc.rust-lang.org/cargo/reference/config.html>.
43+
44+
-q, --quiet
45+
Do not print cargo log messages. May also be specified with the
46+
term.quiet config value
47+
<https://doc.rust-lang.org/cargo/reference/config.html>.
48+
49+
--color when
50+
Control when colored output is used. Valid values:
51+
52+
o auto (default): Automatically detect if color support is
53+
available on the terminal.
54+
55+
o always: Always display colors.
56+
57+
o never: Never display colors.
58+
59+
May also be specified with the term.color config value
60+
<https://doc.rust-lang.org/cargo/reference/config.html>.
61+
62+
Manifest Options
63+
--locked
64+
Asserts that the exact same dependencies and versions are used as
65+
when the existing Cargo.lock file was originally generated. Cargo
66+
will exit with an error when either of the following scenarios
67+
arises:
68+
69+
o The lock file is missing.
70+
71+
o Cargo attempted to change the lock file due to a different
72+
dependency resolution.
73+
74+
It may be used in environments where deterministic builds are
75+
desired, such as in CI pipelines.
76+
77+
--offline
78+
Prevents Cargo from accessing the network for any reason. Without
79+
this flag, Cargo will stop with an error if it needs to access the
80+
network and the network is not available. With this flag, Cargo will
81+
attempt to proceed without the network if possible.
82+
83+
Beware that this may result in different dependency resolution than
84+
online mode. Cargo will restrict itself to crates that are
85+
downloaded locally, even if there might be a newer version as
86+
indicated in the local copy of the index. See the cargo-fetch(1)
87+
command to download dependencies before going offline.
88+
89+
May also be specified with the net.offline config value
90+
<https://doc.rust-lang.org/cargo/reference/config.html>.
91+
92+
--frozen
93+
Equivalent to specifying both --locked and --offline.
94+
95+
Common Options
96+
+toolchain
97+
If Cargo has been installed with rustup, and the first argument to
98+
cargo begins with +, it will be interpreted as a rustup toolchain
99+
name (such as +stable or +nightly). See the rustup documentation
100+
<https://rust-lang.github.io/rustup/overrides.html> for more
101+
information about how toolchain overrides work.
102+
103+
--config KEY=VALUE or PATH
104+
Overrides a Cargo configuration value. The argument should be in
105+
TOML syntax of KEY=VALUE, or provided as a path to an extra
106+
configuration file. This flag may be specified multiple times. See
107+
the command-line overrides section
108+
<https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
109+
for more information.
110+
111+
-C PATH
112+
Changes the current working directory before executing any specified
113+
operations. This affects things like where cargo looks by default
114+
for the project manifest (Cargo.toml), as well as the directories
115+
searched for discovering .cargo/config.toml, for example. This
116+
option must appear before the command name, for example cargo -C
117+
path/to/my-project build.
118+
119+
This option is only available on the nightly channel
120+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
121+
requires the -Z unstable-options flag to enable (see #10098
122+
<https://github.com/rust-lang/cargo/issues/10098>).
123+
124+
-h, --help
125+
Prints help information.
126+
127+
-Z flag
128+
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
129+
details.
130+
131+
ENVIRONMENT
132+
See the reference
133+
<https://doc.rust-lang.org/cargo/reference/environment-variables.html>
134+
for details on environment variables that Cargo reads.
135+
136+
EXIT STATUS
137+
o 0: Cargo succeeded.
138+
139+
o 101: Cargo failed to complete.
140+
141+
EXAMPLES
142+
1. Inspect the serde package from crates.io:
143+
144+
cargo info serde
145+
146+
2. Inspect the serde package with version 1.0.0:
147+
148+
cargo info [email protected]
149+
150+
3. Inspect the serde package form the local registry:
151+
152+
cargo info serde --registry my-registry
153+
154+
SEE ALSO
155+
cargo(1), cargo-search(1)
156+

src/doc/man/generated_txt/cargo.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ COMMANDS
5656
cargo-generate-lockfile(1)
5757
    Generate Cargo.lock for a project.
5858

59+
cargo-info(1)
60+
    Display information about a package in the registry. Default
61+
registry is crates.io.
62+
5963
cargo-locate-project(1)
6064
    Print a JSON representation of a Cargo.toml file’s location.
6165

src/doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
* [Manifest Commands](commands/manifest-commands.md)
7070
* [cargo add](commands/cargo-add.md)
7171
* [cargo generate-lockfile](commands/cargo-generate-lockfile.md)
72+
* [cargo info](commands/cargo-info.md)
7273
* [cargo locate-project](commands/cargo-locate-project.md)
7374
* [cargo metadata](commands/cargo-metadata.md)
7475
* [cargo pkgid](commands/cargo-pkgid.md)

0 commit comments

Comments
 (0)