mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-22 10:04:02 +00:00
Add color and wrapping to cli help text (#3849)
This commit is contained in:
@@ -33,7 +33,7 @@ sqlx = { workspace = true, default-features = false, features = [
|
||||
"any",
|
||||
] }
|
||||
futures = "0.3.19"
|
||||
clap = { version = "4.3.10", features = ["derive", "env"] }
|
||||
clap = { version = "4.3.10", features = ["derive", "env", "wrap_help"] }
|
||||
clap_complete = { version = "4.3.1", optional = true }
|
||||
chrono = { version = "0.4.19", default-features = false, features = ["clock"] }
|
||||
anyhow = "1.0.52"
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user