1CARGO-LOCATE-PROJECT(1) General Commands Manual CARGO-LOCATE-PROJECT(1)
2
3
4
6 cargo-locate-project - Print a JSON representation of a Cargo.toml
7 file's location
8
10 cargo locate-project [options]
11
13 This command will print a JSON object to stdout with the full path to
14 the manifest. The manifest is found by searching upward for a file
15 named Cargo.toml starting from the current working directory.
16
17 If the project happens to be a part of a workspace, the manifest of the
18 project, rather than the workspace root, is output. This can be
19 overriden by the --workspace flag. The root workspace is found by
20 traversing further upward or by using the field package.workspace after
21 locating the manifest of a workspace member.
22
24 --workspace
25 Locate the Cargo.toml at the root of the workspace, as opposed to
26 the current workspace member.
27
28 Display Options
29 --message-format fmt
30 The representation in which to print the project location. Valid
31 values:
32
33 • json (default): JSON object with the path under the key "root".
34
35 • plain: Just the path.
36
37 -v, --verbose
38 Use verbose output. May be specified twice for "very verbose"
39 output which includes extra output such as dependency warnings and
40 build script output. May also be specified with the term.verbose
41 config value
42 <https://doc.rust-lang.org/cargo/reference/config.html>.
43
44 -q, --quiet
45 Do not print cargo log messages. May also be specified with the
46 term.quiet config value
47 <https://doc.rust-lang.org/cargo/reference/config.html>.
48
49 --color when
50 Control when colored output is used. Valid values:
51
52 • auto (default): Automatically detect if color support is
53 available on the terminal.
54
55 • always: Always display colors.
56
57 • never: Never display colors.
58
59 May also be specified with the term.color config value
60 <https://doc.rust-lang.org/cargo/reference/config.html>.
61
62 Manifest Options
63 --manifest-path path
64 Path to the Cargo.toml file. By default, Cargo searches for the
65 Cargo.toml file in the current directory or any parent directory.
66
67 Common Options
68 +toolchain
69 If Cargo has been installed with rustup, and the first argument to
70 cargo begins with +, it will be interpreted as a rustup toolchain
71 name (such as +stable or +nightly). See the rustup documentation
72 <https://rust-lang.github.io/rustup/overrides.html> for more
73 information about how toolchain overrides work.
74
75 --config KEY=VALUE or PATH
76 Overrides a Cargo configuration value. The argument should be in
77 TOML syntax of KEY=VALUE, or provided as a path to an extra
78 configuration file. This flag may be specified multiple times. See
79 the command-line overrides section
80 <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
81 for more information.
82
83 -h, --help
84 Prints help information.
85
86 -Z flag
87 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
88 details.
89
91 See the reference
92 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
93 for details on environment variables that Cargo reads.
94
96 • 0: Cargo succeeded.
97
98 • 101: Cargo failed to complete.
99
101 1. Display the path to the manifest based on the current directory:
102
103 cargo locate-project
104
106 cargo(1), cargo-metadata(1)
107
108
109
110 CARGO-LOCATE-PROJECT(1)