Skip to content

Commit 9f9ff62

Browse files
committed
docs(package): man page for cargo package --message-format
1 parent 781c7ed commit 9f9ff62

File tree

4 files changed

+175
-0
lines changed

4 files changed

+175
-0
lines changed

src/doc/man/cargo-package.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,48 @@ lock-files will be generated under the assumption that dependencies will be
116116
published to this registry.
117117
{{/option}}
118118

119+
{{#option "`--message-format` _fmt_" }}
120+
Specifies the output message format.
121+
Currently, it only works with `--list` and affects the file listing format.
122+
This is unstable and requires `-Zunstable-options`.
123+
Valid output formats:
124+
125+
- `human` (default): Display in a file-per-line format.
126+
- `json`: Emit machine-readable JSON information about each package.
127+
One package per JSON line (Newline delimited JSON).
128+
```javascript
129+
{
130+
/* The Package ID Spec of the package. */
131+
"id": "path+file:///home/foo#0.0.0",
132+
/* Files of this package */
133+
"files" {
134+
/* Relative path in the archive file. */
135+
"Cargo.toml.orig": {
136+
/* Where the file is from.
137+
- "generate" for file being generated during packaging
138+
- "copy" for file being copied from another location.
139+
*/
140+
"kind": "copy",
141+
/* For the "copy" kind,
142+
it is an absolute path to the actual file content.
143+
For the "generate" kind,
144+
it is the original file the generated one is based on.
145+
*/
146+
"path": "/home/foo/Cargo.toml"
147+
},
148+
"Cargo.toml": {
149+
"kind": "generate",
150+
"path": "/home/foo/Cargo.toml"
151+
},
152+
"src/main.rs": {
153+
"kind": "copy",
154+
"path": "/home/foo/src/main.rs"
155+
}
156+
}
157+
}
158+
```
159+
{{/option}}
160+
119161
{{/options}}
120162

121163
{{> section-package-selection }}

src/doc/man/generated_txt/cargo-package.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,45 @@ OPTIONS
114114
multiple inter-dependent crates, lock-files will be generated under
115115
the assumption that dependencies will be published to this registry.
116116

117+
--message-format fmt
118+
Specifies the output message format. Currently, it only works with
119+
--list and affects the file listing format. This is unstable and
120+
requires -Zunstable-options. Valid output formats:
121+
122+
o human (default): Display in a file-per-line format.
123+
124+
o json: Emit machine-readable JSON information about each package.
125+
One package per JSON line (Newline delimited JSON).
126+
{
127+
/* The Package ID Spec of the package. */
128+
"id": "path+file:///home/foo#0.0.0",
129+
/* Files of this package */
130+
"files" {
131+
/* Relative path in the archive file. */
132+
"Cargo.toml.orig": {
133+
/* Where the file is from.
134+
- "generate" for file being generated during packaging
135+
- "copy" for file being copied from another location.
136+
*/
137+
"kind": "copy",
138+
/* For the "copy" kind,
139+
it is an absolute path to the actual file content.
140+
For the "generate" kind,
141+
it is the original file the generated one is based on.
142+
*/
143+
"path": "/home/foo/Cargo.toml"
144+
},
145+
"Cargo.toml": {
146+
"kind": "generate",
147+
"path": "/home/foo/Cargo.toml"
148+
},
149+
"src/main.rs": {
150+
"kind": "copy",
151+
"path": "/home/foo/src/main.rs"
152+
}
153+
}
154+
}
155+
117156
Package Selection
118157
By default, when no package selection options are given, the packages
119158
selected depend on the selected manifest file (based on the current

src/doc/src/commands/cargo-package.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,49 @@ lock-files will be generated under the assumption that dependencies will be
113113
published to this registry.</dd>
114114

115115

116+
<dt class="option-term" id="option-cargo-package---message-format"><a class="option-anchor" href="#option-cargo-package---message-format"></a><code>--message-format</code> <em>fmt</em></dt>
117+
<dd class="option-desc">Specifies the output message format.
118+
Currently, it only works with <code>--list</code> and affects the file listing format.
119+
This is unstable and requires <code>-Zunstable-options</code>.
120+
Valid output formats:</p>
121+
<ul>
122+
<li><code>human</code> (default): Display in a file-per-line format.</li>
123+
<li><code>json</code>: Emit machine-readable JSON information about each package.
124+
One package per JSON line (Newline delimited JSON).
125+
<pre><code class="language-javascript">{
126+
/* The Package ID Spec of the package. */
127+
"id": "path+file:///home/foo#0.0.0",
128+
/* Files of this package */
129+
"files" {
130+
/* Relative path in the archive file. */
131+
"Cargo.toml.orig": {
132+
/* Where the file is from.
133+
- "generate" for file being generated during packaging
134+
- "copy" for file being copied from another location.
135+
*/
136+
"kind": "copy",
137+
/* For the "copy" kind,
138+
it is an absolute path to the actual file content.
139+
For the "generate" kind,
140+
it is the original file the generated one is based on.
141+
*/
142+
"path": "/home/foo/Cargo.toml"
143+
},
144+
"Cargo.toml": {
145+
"kind": "generate",
146+
"path": "/home/foo/Cargo.toml"
147+
},
148+
"src/main.rs": {
149+
"kind": "copy",
150+
"path": "/home/foo/src/main.rs"
151+
}
152+
}
153+
}
154+
</code></pre>
155+
</li>
156+
</ul></dd>
157+
158+
116159
</dl>
117160

118161
### Package Selection

src/etc/man/cargo-package.1

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,57 @@ to this registry, but if we are packaging multiple inter\-dependent crates,
149149
lock\-files will be generated under the assumption that dependencies will be
150150
published to this registry.
151151
.RE
152+
.sp
153+
\fB\-\-message\-format\fR \fIfmt\fR
154+
.RS 4
155+
Specifies the output message format.
156+
Currently, it only works with \fB\-\-list\fR and affects the file listing format.
157+
This is unstable and requires \fB\-Zunstable\-options\fR\&.
158+
Valid output formats:
159+
.sp
160+
.RS 4
161+
\h'-04'\(bu\h'+03'\fBhuman\fR (default): Display in a file\-per\-line format.
162+
.RE
163+
.sp
164+
.RS 4
165+
\h'-04'\(bu\h'+03'\fBjson\fR: Emit machine\-readable JSON information about each package.
166+
One package per JSON line (Newline delimited JSON).
167+
.sp
168+
.RS 4
169+
.nf
170+
{
171+
/* The Package ID Spec of the package. */
172+
"id": "path+file:///home/foo#0.0.0",
173+
/* Files of this package */
174+
"files" {
175+
/* Relative path in the archive file. */
176+
"Cargo.toml.orig": {
177+
/* Where the file is from.
178+
\- "generate" for file being generated during packaging
179+
\- "copy" for file being copied from another location.
180+
*/
181+
"kind": "copy",
182+
/* For the "copy" kind,
183+
it is an absolute path to the actual file content.
184+
For the "generate" kind,
185+
it is the original file the generated one is based on.
186+
*/
187+
"path": "/home/foo/Cargo.toml"
188+
},
189+
"Cargo.toml": {
190+
"kind": "generate",
191+
"path": "/home/foo/Cargo.toml"
192+
},
193+
"src/main.rs": {
194+
"kind": "copy",
195+
"path": "/home/foo/src/main.rs"
196+
}
197+
}
198+
}
199+
.fi
200+
.RE
201+
.RE
202+
.RE
152203
.SS "Package Selection"
153204
By default, when no package selection options are given, the packages selected
154205
depend on the selected manifest file (based on the current working directory if

0 commit comments

Comments
 (0)