Skip to content

Commit bd43e72

Browse files
nbafrankclaude
andcommitted
Release v0.2.13: colorize clap help output
Clap 4 made help styling opt-in; without `styles = ...` the help text renders as plain bold-less monochrome. Added a Styles block matching uvr's runtime palette: cyan headers/usage, magenta literal flags, yellow placeholders. Renders only in TTY contexts (clap's anstream auto-disables on pipes), so CI / scripted usage stays clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 52efb2b commit bd43e72

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["crates/uvr", "crates/uvr-core"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.2.12"
6+
version = "0.2.13"
77
edition = "2021"
88
authors = ["uvr contributors"]
99
license = "MIT"

crates/uvr/src/cli.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
use std::path::PathBuf;
22

3+
use clap::builder::styling;
34
use clap::{Args, Parser, Subcommand};
45
use clap_complete::Shell;
56

67
use crate::commands::export::ExportFormat;
78

9+
/// Match the runtime palette: cyan accents for headers/usage, magenta for
10+
/// literal flag names, yellow for placeholders. Keeps `--help` visually of
11+
/// a piece with the rest of uvr's output. Clap 4 made help styling opt-in,
12+
/// so without this block the help text renders flat.
13+
const HELP_STYLES: styling::Styles = styling::Styles::styled()
14+
.header(styling::AnsiColor::Cyan.on_default().bold())
15+
.usage(styling::AnsiColor::Cyan.on_default().bold())
16+
.literal(styling::AnsiColor::Magenta.on_default().bold())
17+
.placeholder(styling::AnsiColor::Yellow.on_default());
18+
819
#[derive(Debug, Parser)]
920
#[command(
1021
name = "uvr",
1122
version,
1223
about = "Fast, reproducible R package management",
1324
long_about = None,
25+
styles = HELP_STYLES,
1426
)]
1527
pub struct Cli {
1628
/// Enable verbose output

0 commit comments

Comments
 (0)