fork/cargo

git clone https://git.julia.blue/fork/cargo

borsAuto merge of #11960 - ehuss:chdir-unstable, r=weihanglo1ce01c5e5

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