mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 07:45:30 +00:00
Add color and wrapping to cli help text (#3849)
This commit is contained in:
parent
5736ab6c21
commit
6b2e0247d4
30
Cargo.lock
generated
30
Cargo.lock
generated
@ -805,6 +805,7 @@ dependencies = [
|
|||||||
"anstyle",
|
"anstyle",
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
"strsim",
|
"strsim",
|
||||||
|
"terminal_size",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2104,6 +2105,12 @@ version = "0.4.15"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.9.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "litemap"
|
name = "litemap"
|
||||||
version = "0.7.4"
|
version = "0.7.4"
|
||||||
@ -3013,6 +3020,19 @@ dependencies = [
|
|||||||
"windows-sys 0.59.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "1.0.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.7.0",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys 0.9.4",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.21"
|
version = "0.23.21"
|
||||||
@ -3986,6 +4006,16 @@ dependencies = [
|
|||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "terminal_size"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "45c6481c4829e4cc63825e62c49186a34538b7b2750b73b266581ffb612fb5ed"
|
||||||
|
dependencies = [
|
||||||
|
"rustix 1.0.5",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termtree"
|
name = "termtree"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -33,7 +33,7 @@ sqlx = { workspace = true, default-features = false, features = [
|
|||||||
"any",
|
"any",
|
||||||
] }
|
] }
|
||||||
futures = "0.3.19"
|
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 }
|
clap_complete = { version = "4.3.1", optional = true }
|
||||||
chrono = { version = "0.4.19", default-features = false, features = ["clock"] }
|
chrono = { version = "0.4.19", default-features = false, features = ["clock"] }
|
||||||
anyhow = "1.0.52"
|
anyhow = "1.0.52"
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
use std::ops::{Deref, Not};
|
use std::ops::{Deref, Not};
|
||||||
|
|
||||||
use clap::{Args, Parser};
|
use clap::{
|
||||||
|
builder::{styling::AnsiColor, Styles},
|
||||||
|
Args, Parser,
|
||||||
|
};
|
||||||
#[cfg(feature = "completions")]
|
#[cfg(feature = "completions")]
|
||||||
use clap_complete::Shell;
|
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)]
|
#[derive(Parser, Debug)]
|
||||||
#[clap(version, about, author)]
|
#[clap(version, about, author, styles = HELP_STYLES)]
|
||||||
pub struct Opt {
|
pub struct Opt {
|
||||||
// https://github.com/launchbadge/sqlx/pull/3724 placed this here,
|
// https://github.com/launchbadge/sqlx/pull/3724 placed this here,
|
||||||
// but the intuitive place would be in the arguments for each subcommand.
|
// but the intuitive place would be in the arguments for each subcommand.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user