1CARGO-PKGID(1)              General Commands Manual             CARGO-PKGID(1)
2
3
4

NAME

6       cargo-pkgid — Print a fully qualified package specification
7

SYNOPSIS

9       cargo pkgid [options] [spec]
10

DESCRIPTION

12       Given a spec argument, print out the fully qualified package ID
13       specifier for a package or dependency in the current workspace. This
14       command will generate an error if spec is ambiguous as to which package
15       it refers to in the dependency graph. If no spec is given, then the
16       specifier for the local package is printed.
17
18       This command requires that a lockfile is available and dependencies
19       have been fetched.
20
21       A package specifier consists of a name, version, and source URL. You
22       are allowed to use partial specifiers to succinctly match a specific
23       package as long as it matches only one package. The format of a spec
24       can be one of the following:
25
26
27       ┌─────────────────┬───────────────────────────────────────────────────────┐
28       │SPEC Structure   │ Example SPEC                                          │
29       ├─────────────────┼───────────────────────────────────────────────────────┤
30namebitflags                                              
31       ├─────────────────┼───────────────────────────────────────────────────────┤
32name@version     │ bitflags@1.0.4                                        
33       ├─────────────────┼───────────────────────────────────────────────────────┤
34urlhttps://github.com/rust-lang/cargo                    
35       ├─────────────────┼───────────────────────────────────────────────────────┤
36url#version      │ https://github.com/rust-lang/cargo#0.33.0             
37       ├─────────────────┼───────────────────────────────────────────────────────┤
38url#name         │ https://github.com/rust-lang/crates.io-index#bitflags 
39       ├─────────────────┼───────────────────────────────────────────────────────┤
40url#name@version │ https://github.com/rust-lang/cargo#crates-io@0.21.0   
41       └─────────────────┴───────────────────────────────────────────────────────┘
42

OPTIONS

44   Package Selection
45       -p spec, --package spec
46           Get the package ID for the given package instead of the current
47           package.
48
49   Display Options
50       -v, --verbose
51           Use verbose output. May be specified twice for “very verbose”
52           output which includes extra output such as dependency warnings and
53           build script output. May also be specified with the term.verbose
54           config value
55           <https://doc.rust-lang.org/cargo/reference/config.html>.
56
57       -q, --quiet
58           Do not print cargo log messages. May also be specified with the
59           term.quiet config value
60           <https://doc.rust-lang.org/cargo/reference/config.html>.
61
62       --color when
63           Control when colored output is used. Valid values:
64
65auto (default): Automatically detect if color support is
66               available on the terminal.
67
68always: Always display colors.
69
70never: Never display colors.
71
72           May also be specified with the term.color config value
73           <https://doc.rust-lang.org/cargo/reference/config.html>.
74
75   Manifest Options
76       --manifest-path path
77           Path to the Cargo.toml file. By default, Cargo searches for the
78           Cargo.toml file in the current directory or any parent directory.
79
80       --frozen, --locked
81           Either of these flags requires that the Cargo.lock file is
82           up-to-date. If the lock file is missing, or it needs to be updated,
83           Cargo will exit with an error. The --frozen flag also prevents
84           Cargo from attempting to access the network to determine if it is
85           out-of-date.
86
87           These may be used in environments where you want to assert that the
88           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
89           network access.
90
91       --offline
92           Prevents Cargo from accessing the network for any reason. Without
93           this flag, Cargo will stop with an error if it needs to access the
94           network and the network is not available. With this flag, Cargo
95           will attempt to proceed without the network if possible.
96
97           Beware that this may result in different dependency resolution than
98           online mode. Cargo will restrict itself to crates that are
99           downloaded locally, even if there might be a newer version as
100           indicated in the local copy of the index. See the cargo-fetch(1)
101           command to download dependencies before going offline.
102
103           May also be specified with the net.offline config value
104           <https://doc.rust-lang.org/cargo/reference/config.html>.
105
106   Common Options
107       +toolchain
108           If Cargo has been installed with rustup, and the first argument to
109           cargo begins with +, it will be interpreted as a rustup toolchain
110           name (such as +stable or +nightly). See the rustup documentation
111           <https://rust-lang.github.io/rustup/overrides.html> for more
112           information about how toolchain overrides work.
113
114       --config KEY=VALUE or PATH
115           Overrides a Cargo configuration value. The argument should be in
116           TOML syntax of KEY=VALUE, or provided as a path to an extra
117           configuration file. This flag may be specified multiple times. See
118           the command-line overrides section
119           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
120           for more information.
121
122       -C PATH
123           Changes the current working directory before executing any
124           specified operations. This affects things like where cargo looks by
125           default for the project manifest (Cargo.toml), as well as the
126           directories searched for discovering .cargo/config.toml, for
127           example. This option must appear before the command name, for
128           example cargo -C path/to/my-project build.
129
130           This option is only available on the nightly channel
131           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
132           requires the -Z unstable-options flag to enable (see #10098
133           <https://github.com/rust-lang/cargo/issues/10098>).
134
135       -h, --help
136           Prints help information.
137
138       -Z flag
139           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
140           details.
141

ENVIRONMENT

143       See the reference
144       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
145       for details on environment variables that Cargo reads.
146

EXIT STATUS

1480: Cargo succeeded.
149
150101: Cargo failed to complete.
151

EXAMPLES

153        1. Retrieve package specification for foo package:
154
155               cargo pkgid foo
156
157        2. Retrieve package specification for version 1.0.0 of foo:
158
159               cargo pkgid foo@1.0.0
160
161        3. Retrieve package specification for foo from crates.io:
162
163               cargo pkgid https://github.com/rust-lang/crates.io-index#foo
164
165        4. Retrieve package specification for foo from a local package:
166
167               cargo pkgid file:///path/to/local/package#foo
168

SEE ALSO

170       cargo(1), cargo-generate-lockfile(1), cargo-metadata(1)
171
172
173
174                                                                CARGO-PKGID(1)
Impressum