Add color and wrapping to cli help text (#3849)

This commit is contained in:
Josh McKinney
2025-05-02 18:48:46 -07:00
committed by GitHub
parent 5736ab6c21
commit 6b2e0247d4
3 changed files with 42 additions and 3 deletions

View File

@@ -1,11 +1,20 @@
use std::ops::{Deref, Not};
use clap::{Args, Parser};
use clap::{
builder::{styling::AnsiColor, Styles},
Args, Parser,
};
#[cfg(feature = "completions")]
use clap_complete::Shell;
const HELP_STYLES: Styles = Styles::styled()
.header(AnsiColor::Blue.on_default().bold())
.usage(AnsiColor::Blue.on_default().bold())
.literal(AnsiColor::White.on_default())
.placeholder(AnsiColor::Green.on_default());
#[derive(Parser, Debug)]
#[clap(version, about, author)]
#[clap(version, about, author, styles = HELP_STYLES)]
pub struct Opt {
// https://github.com/launchbadge/sqlx/pull/3724 placed this here,
// but the intuitive place would be in the arguments for each subcommand.