1CARGO-LOCATE-PROJECT(1)     General Commands Manual    CARGO-LOCATE-PROJECT(1)
2
3
4

NAME

6       cargo-locate-project — Print a JSON representation of a Cargo.toml
7       file’s location
8

SYNOPSIS

10       cargo locate-project [options]
11

DESCRIPTION

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       overridden 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

OPTIONS

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
33json (default): JSON object with the path under the key “root”.
34
35plain: 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
52auto (default): Automatically detect if color support is
53               available on the terminal.
54
55always: Always display colors.
56
57never: 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       -C PATH
84           Changes the current working directory before executing any
85           specified operations. This affects things like where cargo looks by
86           default for the project manifest (Cargo.toml), as well as the
87           directories searched for discovering .cargo/config.toml, for
88           example. This option must appear before the command name, for
89           example cargo -C path/to/my-project build.
90
91           This option is only available on the nightly channel
92           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
93           requires the -Z unstable-options flag to enable (see #10098
94           <https://github.com/rust-lang/cargo/issues/10098>).
95
96       -h, --help
97           Prints help information.
98
99       -Z flag
100           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
101           details.
102

ENVIRONMENT

104       See the reference
105       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
106       for details on environment variables that Cargo reads.
107

EXIT STATUS

1090: Cargo succeeded.
110
111101: Cargo failed to complete.
112

EXAMPLES

114        1. Display the path to the manifest based on the current directory:
115
116               cargo locate-project
117

SEE ALSO

119       cargo(1), cargo-metadata(1)
120
121
122
123                                                       CARGO-LOCATE-PROJECT(1)
Impressum