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           No output printed to stdout.
59
60       --color when
61           Control when colored output is used. Valid values:
62
63auto (default): Automatically detect if color support is
64               available on the terminal.
65
66always: Always display colors.
67
68never: Never display colors.
69
70           May also be specified with the term.color config value
71           <https://doc.rust-lang.org/cargo/reference/config.html>.
72
73   Manifest Options
74       --manifest-path path
75           Path to the Cargo.toml file. By default, Cargo searches for the
76           Cargo.toml file in the current directory or any parent directory.
77
78       --frozen, --locked
79           Either of these flags requires that the Cargo.lock file is
80           up-to-date. If the lock file is missing, or it needs to be updated,
81           Cargo will exit with an error. The --frozen flag also prevents
82           Cargo from attempting to access the network to determine if it is
83           out-of-date.
84
85           These may be used in environments where you want to assert that the
86           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
87           network access.
88
89       --offline
90           Prevents Cargo from accessing the network for any reason. Without
91           this flag, Cargo will stop with an error if it needs to access the
92           network and the network is not available. With this flag, Cargo
93           will attempt to proceed without the network if possible.
94
95           Beware that this may result in different dependency resolution than
96           online mode. Cargo will restrict itself to crates that are
97           downloaded locally, even if there might be a newer version as
98           indicated in the local copy of the index. See the cargo-fetch(1)
99           command to download dependencies before going offline.
100
101           May also be specified with the net.offline config value
102           <https://doc.rust-lang.org/cargo/reference/config.html>.
103
104   Common Options
105       +toolchain
106           If Cargo has been installed with rustup, and the first argument to
107           cargo begins with +, it will be interpreted as a rustup toolchain
108           name (such as +stable or +nightly). See the rustup documentation
109           <https://rust-lang.github.io/rustup/overrides.html> for more
110           information about how toolchain overrides work.
111
112       -h, --help
113           Prints help information.
114
115       -Z flag
116           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
117           details.
118

ENVIRONMENT

120       See the reference
121       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
122       for details on environment variables that Cargo reads.
123

EXIT STATUS

1250: Cargo succeeded.
126
127101: Cargo failed to complete.
128

EXAMPLES

130        1. Retrieve package specification for foo package:
131
132               cargo pkgid foo
133
134        2. Retrieve package specification for version 1.0.0 of foo:
135
136               cargo pkgid foo:1.0.0
137
138        3. Retrieve package specification for foo from crates.io:
139
140               cargo pkgid https://github.com/rust-lang/crates.io-index#foo
141
142        4. Retrieve package specification for foo from a local package:
143
144               cargo pkgid file:///path/to/local/package#foo
145

SEE ALSO

147       cargo(1), cargo-generate-lockfile(1), cargo-metadata(1)
148
149
150
151                                                                CARGO-PKGID(1)
Impressum