1 # cargo-locate-project(1)
5 cargo-locate-project - Print a JSON representation of a Cargo.toml file's location
9 `cargo locate-project` [_options_]
13 This command will print a JSON object to stdout with the full path to the
14 `Cargo.toml` manifest.
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>
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>
34 <li><code>json</code> (default): JSON object with the path under the key "root".</li>
35 <li><code>plain</code>: Just the path.</li>
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 "very verbose" 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>
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>
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>
57 <li><code>auto</code> (default): Automatically detect if color support is available on the
59 <li><code>always</code>: Always display colors.</li>
60 <li><code>never</code>: Never display colors.</li>
62 <p>May also be specified with the <code>term.color</code>
63 <a href="../reference/config.html">config value</a>.</dd>
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>
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>
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>
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>
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>
110 See [the reference](../reference/environment-variables.html) for
111 details on environment variables that Cargo reads.
116 * `0`: Cargo succeeded.
117 * `101`: Cargo failed to complete.
122 1. Display the path to the manifest based on the current directory:
127 [cargo(1)](cargo.html), [cargo-metadata(1)](cargo-metadata.html)