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       -h, --help
123           Prints help information.
124
125       -Z flag
126           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
127           details.
128

ENVIRONMENT

130       See the reference
131       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
132       for details on environment variables that Cargo reads.
133

EXIT STATUS

1350: Cargo succeeded.
136
137101: Cargo failed to complete.
138

EXAMPLES

140        1. Retrieve package specification for foo package:
141
142               cargo pkgid foo
143
144        2. Retrieve package specification for version 1.0.0 of foo:
145
146               cargo pkgid foo@1.0.0
147
148        3. Retrieve package specification for foo from crates.io:
149
150               cargo pkgid https://github.com/rust-lang/crates.io-index#foo
151
152        4. Retrieve package specification for foo from a local package:
153
154               cargo pkgid file:///path/to/local/package#foo
155

SEE ALSO

157       cargo(1), cargo-generate-lockfile(1), cargo-metadata(1)
158
159
160
161                                                                CARGO-PKGID(1)
Impressum