Skip to content

Commit 591bc34

Browse files
authored
display aliases for long and short args in the cli reference (#12824)
Fixes #12494 (I don't feel like showing it in long-help matters too much...)
1 parent 039b3c5 commit 591bc34

File tree

2 files changed

+153
-147
lines changed

2 files changed

+153
-147
lines changed

crates/uv-dev/src/generate_cli_reference.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,16 @@ fn generate_command<'a>(output: &mut String, command: &'a Command, parents: &mut
232232
let id = format!("{name_key}--{long}");
233233

234234
output.push_str(&format!("<dt id=\"{id}\">"));
235-
output.push_str(&format!("<a href=\"#{id}\"><code>--{long}</code></a>",));
235+
output.push_str(&format!("<a href=\"#{id}\"><code>--{long}</code></a>"));
236+
for long_alias in opt.get_all_aliases().into_iter().flatten() {
237+
output.push_str(&format!(", <code>--{long_alias}</code>"));
238+
}
236239
if let Some(short) = opt.get_short() {
237240
output.push_str(&format!(", <code>-{short}</code>"));
238241
}
242+
for short_alias in opt.get_all_short_aliases().into_iter().flatten() {
243+
output.push_str(&format!(", <code>-{short_alias}</code>"));
244+
}
239245

240246
// Re-implements private `Arg::is_takes_value_set` used in `Command::get_opts`
241247
if opt

0 commit comments

Comments
 (0)