]> git.proxmox.com Git - cargo.git/blob - src/doc/src/commands/cargo-locate-project.md
7c7e51cfa63d99cbf284512fa1d0dfb828bc08c1
[cargo.git] / src / doc / src / commands / cargo-locate-project.md
1 # cargo-locate-project(1)
2
3 ## NAME
4
5 cargo-locate-project - Print a JSON representation of a Cargo.toml file's location
6
7 ## SYNOPSIS
8
9 `cargo locate-project` [_options_]
10
11 ## DESCRIPTION
12
13 This command will print a JSON object to stdout with the full path to the
14 `Cargo.toml` manifest.
15
16 ## OPTIONS
17
18 <dl>
19
20 <dt class="option-term" id="option-cargo-locate-project---workspace"><a class="option-anchor" href="#option-cargo-locate-project---workspace"></a><code>--workspace</code></dt>
21 <dd class="option-desc">Locate the <code>Cargo.toml</code> at the root of the workspace, as opposed to the current
22 workspace member.</dd>
23
24
25 </dl>
26
27 ### Display Options
28
29 <dl>
30
31 <dt class="option-term" id="option-cargo-locate-project---message-format"><a class="option-anchor" href="#option-cargo-locate-project---message-format"></a><code>--message-format</code> <em>fmt</em></dt>
32 <dd class="option-desc">The representation in which to print the project location. Valid values:</p>
33 <ul>
34 <li><code>json</code> (default): JSON object with the path under the key &quot;root&quot;.</li>
35 <li><code>plain</code>: Just the path.</li>
36 </ul></dd>
37
38
39 <dt class="option-term" id="option-cargo-locate-project--v"><a class="option-anchor" href="#option-cargo-locate-project--v"></a><code>-v</code></dt>
40 <dt class="option-term" id="option-cargo-locate-project---verbose"><a class="option-anchor" href="#option-cargo-locate-project---verbose"></a><code>--verbose</code></dt>
41 <dd class="option-desc">Use verbose output. May be specified twice for &quot;very verbose&quot; output which
42 includes extra output such as dependency warnings and build script output.
43 May also be specified with the <code>term.verbose</code>
44 <a href="../reference/config.html">config value</a>.</dd>
45
46
47 <dt class="option-term" id="option-cargo-locate-project--q"><a class="option-anchor" href="#option-cargo-locate-project--q"></a><code>-q</code></dt>
48 <dt class="option-term" id="option-cargo-locate-project---quiet"><a class="option-anchor" href="#option-cargo-locate-project---quiet"></a><code>--quiet</code></dt>
49 <dd class="option-desc">Do not print cargo log messages.
50 May also be specified with the <code>term.quiet</code>
51 <a href="../reference/config.html">config value</a>.</dd>
52
53
54 <dt class="option-term" id="option-cargo-locate-project---color"><a class="option-anchor" href="#option-cargo-locate-project---color"></a><code>--color</code> <em>when</em></dt>
55 <dd class="option-desc">Control when colored output is used. Valid values:</p>
56 <ul>
57 <li><code>auto</code> (default): Automatically detect if color support is available on the
58 terminal.</li>
59 <li><code>always</code>: Always display colors.</li>
60 <li><code>never</code>: Never display colors.</li>
61 </ul>
62 <p>May also be specified with the <code>term.color</code>
63 <a href="../reference/config.html">config value</a>.</dd>
64
65
66 </dl>
67
68 ### Manifest Options
69
70 <dl>
71 <dt class="option-term" id="option-cargo-locate-project---manifest-path"><a class="option-anchor" href="#option-cargo-locate-project---manifest-path"></a><code>--manifest-path</code> <em>path</em></dt>
72 <dd class="option-desc">Path to the <code>Cargo.toml</code> file. By default, Cargo searches for the
73 <code>Cargo.toml</code> file in the current directory or any parent directory.</dd>
74
75
76 </dl>
77
78 ### Common Options
79
80 <dl>
81
82 <dt class="option-term" id="option-cargo-locate-project-+toolchain"><a class="option-anchor" href="#option-cargo-locate-project-+toolchain"></a><code>+</code><em>toolchain</em></dt>
83 <dd class="option-desc">If Cargo has been installed with rustup, and the first argument to <code>cargo</code>
84 begins with <code>+</code>, it will be interpreted as a rustup toolchain name (such
85 as <code>+stable</code> or <code>+nightly</code>).
86 See the <a href="https://rust-lang.github.io/rustup/overrides.html">rustup documentation</a>
87 for more information about how toolchain overrides work.</dd>
88
89
90 <dt class="option-term" id="option-cargo-locate-project---config"><a class="option-anchor" href="#option-cargo-locate-project---config"></a><code>--config</code> <em>KEY=VALUE</em> or <em>PATH</em></dt>
91 <dd class="option-desc">Overrides a Cargo configuration value. The argument should be in TOML syntax of <code>KEY=VALUE</code>,
92 or provided as a path to an extra configuration file. This flag may be specified multiple times.
93 See the <a href="../reference/config.html#command-line-overrides">command-line overrides section</a> for more information.</dd>
94
95
96 <dt class="option-term" id="option-cargo-locate-project--h"><a class="option-anchor" href="#option-cargo-locate-project--h"></a><code>-h</code></dt>
97 <dt class="option-term" id="option-cargo-locate-project---help"><a class="option-anchor" href="#option-cargo-locate-project---help"></a><code>--help</code></dt>
98 <dd class="option-desc">Prints help information.</dd>
99
100
101 <dt class="option-term" id="option-cargo-locate-project--Z"><a class="option-anchor" href="#option-cargo-locate-project--Z"></a><code>-Z</code> <em>flag</em></dt>
102 <dd class="option-desc">Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for details.</dd>
103
104
105 </dl>
106
107
108 ## ENVIRONMENT
109
110 See [the reference](../reference/environment-variables.html) for
111 details on environment variables that Cargo reads.
112
113
114 ## EXIT STATUS
115
116 * `0`: Cargo succeeded.
117 * `101`: Cargo failed to complete.
118
119
120 ## EXAMPLES
121
122 1. Display the path to the manifest based on the current directory:
123
124 cargo locate-project
125
126 ## SEE ALSO
127 [cargo(1)](cargo.html), [cargo-metadata(1)](cargo-metadata.html)