Skip to content

Commit 32141c9

Browse files
epagedjc
authored andcommitted
feat(cli): Add a sub-heading style for 'completion' Help Discussion
1 parent 66ca40d commit 32141c9

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/cli/help.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use anstyle::Style;
12
use clap_cargo::style::{HEADER, LITERAL, PLACEHOLDER};
23

34
pub(crate) fn rustup_help() -> String {
@@ -221,7 +222,7 @@ pub(crate) fn completions_help() -> String {
221222
Here are some common set ups for the three supported shells under
222223
Unix and similar operating systems (such as GNU/Linux).
223224
224-
Bash:
225+
{SUBHEADER}Bash:{SUBHEADER:#}
225226
226227
Completion files are commonly stored in `/etc/bash_completion.d/` for
227228
system-wide commands, but can be stored in
@@ -234,15 +235,15 @@ pub(crate) fn completions_help() -> String {
234235
This installs the completion script. You may have to log out and
235236
log back in to your shell session for the changes to take effect.
236237
237-
Bash (macOS/Homebrew):
238+
{SUBHEADER}Bash (macOS/Homebrew):{SUBHEADER:#}
238239
239240
Homebrew stores bash completion files within the Homebrew directory.
240241
With the `bash-completion` brew formula installed, run the command:
241242
242243
{LITERAL}$ mkdir -p $(brew --prefix)/etc/bash_completion.d{LITERAL:#}
243244
{LITERAL}$ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion{LITERAL:#}
244245
245-
Fish:
246+
{SUBHEADER}Fish:{SUBHEADER:#}
246247
247248
Fish completion files are commonly stored in
248249
`$HOME/.config/fish/completions`. Run the command:
@@ -253,7 +254,7 @@ pub(crate) fn completions_help() -> String {
253254
This installs the completion script. You may have to log out and
254255
log back in to your shell session for the changes to take effect.
255256
256-
Zsh:
257+
{SUBHEADER}Zsh:{SUBHEADER:#}
257258
258259
ZSH completions are commonly stored in any directory listed in
259260
your `$fpath` variable. To use these completions, you must either
@@ -283,15 +284,15 @@ pub(crate) fn completions_help() -> String {
283284
284285
for the new completions to take effect.
285286
286-
Custom locations:
287+
{SUBHEADER}Custom locations:{SUBHEADER:#}
287288
288289
Alternatively, you could save these files to the place of your
289290
choosing, such as a custom directory inside your $HOME. Doing so
290291
will require you to add the proper directives, such as `source`ing
291292
inside your login script. Consult your shells documentation for
292293
how to add such directives.
293294
294-
PowerShell:
295+
{SUBHEADER}PowerShell:{SUBHEADER:#}
295296
296297
The powershell completion scripts require PowerShell v5.0+ (which
297298
comes with Windows 10, but can be downloaded separately for windows 7
@@ -315,18 +316,18 @@ pub(crate) fn completions_help() -> String {
315316
316317
{LITERAL}PS C:\> rustup completions powershell >> ${{env:USERPROFILE}}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1{LITERAL:#}
317318
318-
Cargo:
319+
{SUBHEADER}Cargo:{SUBHEADER:#}
319320
320321
Rustup can also generate a completion script for `cargo`. The script output
321322
by `rustup` will source the completion script distributed with your default
322323
toolchain. Not all shells are currently supported. Here are examples for
323324
the currently supported shells.
324325
325-
Bash:
326+
{SUBHEADER}Bash:{SUBHEADER:#}
326327
327328
{LITERAL}$ rustup completions bash cargo >> ~/.local/share/bash-completion/completions/cargo{LITERAL:#}
328329
329-
Zsh:
330+
{SUBHEADER}Zsh:{SUBHEADER:#}
330331
331332
{LITERAL}$ rustup completions zsh cargo > ~/.zfunc/_cargo{LITERAL:#}"
332333
)
@@ -359,3 +360,5 @@ pub(crate) fn topic_arg_help() -> &'static str {
359360
'std::fs::read_dir', 'std::io::Bytes', \
360361
'std::iter::Sum', 'std::io::error::Result' etc..."
361362
}
363+
364+
const SUBHEADER: Style = Style::new().bold();

tests/suite/cli_rustup_ui/rustup_completions_cmd_help_flag.stdout.term.svg

Lines changed: 9 additions & 9 deletions
Loading

0 commit comments

Comments
 (0)