Skip to content

Commit eedc244

Browse files
committed
feat(tree): Support long forms for --format variables
1 parent 8d3e73f commit eedc244

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

src/cargo/ops/tree/format/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ impl Pattern {
2525
for raw in Parser::new(format) {
2626
let chunk = match raw {
2727
RawChunk::Text(text) => Chunk::Raw(text.to_owned()),
28-
RawChunk::Argument("p") => Chunk::Package,
29-
RawChunk::Argument("l") => Chunk::License,
30-
RawChunk::Argument("r") => Chunk::Repository,
31-
RawChunk::Argument("f") => Chunk::Features,
28+
RawChunk::Argument("package") | RawChunk::Argument("p") => Chunk::Package,
29+
RawChunk::Argument("license") | RawChunk::Argument("l") => Chunk::License,
30+
RawChunk::Argument("repository") | RawChunk::Argument("r") => Chunk::Repository,
31+
RawChunk::Argument("features") | RawChunk::Argument("f") => Chunk::Features,
3232
RawChunk::Argument("lib") => Chunk::LibName,
3333
RawChunk::Argument(a) => {
3434
bail!("unsupported pattern `{}`", a);

src/doc/man/cargo-tree.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ Set the format string for each package. The default is "{p}".
162162
This is an arbitrary string which will be used to display each package. The following
163163
strings will be replaced with the corresponding value:
164164

165-
- `{p}` --- The package name.
166-
- `{l}` --- The package license.
167-
- `{r}` --- The package repository URL.
168-
- `{f}` --- Comma-separated list of package features that are enabled.
165+
- `{p}`, `{package}` --- The package name.
166+
- `{l}`, `{license}` --- The package license.
167+
- `{r}`, `{repository}` --- The package repository URL.
168+
- `{f}`, `{features}` --- Comma-separated list of package features that are enabled.
169169
- `{lib}` --- The name, as used in a `use` statement, of the package's library.
170170
{{/option}}
171171

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ OPTIONS
154154
package. The following strings will be replaced with the
155155
corresponding value:
156156

157-
o {p} — The package name.
157+
o {p}, {package} — The package name.
158158

159-
o {l} — The package license.
159+
o {l}, {license} — The package license.
160160

161-
o {r} — The package repository URL.
161+
o {r}, {repository} — The package repository URL.
162162

163-
o {f} — Comma-separated list of package features that are
164-
enabled.
163+
o {f}, {features} — Comma-separated list of package features that
164+
are enabled.
165165

166166
o {lib} — The name, as used in a use statement, of the
167167
package’s library.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ The default is the host platform. Use the value <code>all</code> to include <em>
165165
<p>This is an arbitrary string which will be used to display each package. The following
166166
strings will be replaced with the corresponding value:</p>
167167
<ul>
168-
<li><code>{p}</code> — The package name.</li>
169-
<li><code>{l}</code> — The package license.</li>
170-
<li><code>{r}</code> — The package repository URL.</li>
171-
<li><code>{f}</code> — Comma-separated list of package features that are enabled.</li>
168+
<li><code>{p}</code>, <code>{package}</code> — The package name.</li>
169+
<li><code>{l}</code>, <code>{license}</code> — The package license.</li>
170+
<li><code>{r}</code>, <code>{repository}</code> — The package repository URL.</li>
171+
<li><code>{f}</code>, <code>{features}</code> — Comma-separated list of package features that are enabled.</li>
172172
<li><code>{lib}</code> — The name, as used in a <code>use</code> statement, of the package’s library.</li>
173173
</ul>
174174
</dd>

src/etc/man/cargo-tree.1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,19 @@ This is an arbitrary string which will be used to display each package. The foll
190190
strings will be replaced with the corresponding value:
191191
.sp
192192
.RS 4
193-
\h'-04'\(bu\h'+03'\fB{p}\fR \[em] The package name.
193+
\h'-04'\(bu\h'+03'\fB{p}\fR, \fB{package}\fR \[em] The package name.
194194
.RE
195195
.sp
196196
.RS 4
197-
\h'-04'\(bu\h'+03'\fB{l}\fR \[em] The package license.
197+
\h'-04'\(bu\h'+03'\fB{l}\fR, \fB{license}\fR \[em] The package license.
198198
.RE
199199
.sp
200200
.RS 4
201-
\h'-04'\(bu\h'+03'\fB{r}\fR \[em] The package repository URL.
201+
\h'-04'\(bu\h'+03'\fB{r}\fR, \fB{repository}\fR \[em] The package repository URL.
202202
.RE
203203
.sp
204204
.RS 4
205-
\h'-04'\(bu\h'+03'\fB{f}\fR \[em] Comma\-separated list of package features that are enabled.
205+
\h'-04'\(bu\h'+03'\fB{f}\fR, \fB{features}\fR \[em] Comma\-separated list of package features that are enabled.
206206
.RE
207207
.sp
208208
.RS 4

0 commit comments

Comments
 (0)