Update CLI help style
This commit is contained in:
parent
7ea1ea2ca4
commit
311dd4139d
3 changed files with 29 additions and 6 deletions
19
Cargo.lock
generated
19
Cargo.lock
generated
|
@ -250,9 +250,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.4.8"
|
version = "4.4.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64"
|
checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
|
@ -260,14 +260,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.4.8"
|
version = "4.4.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc"
|
checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
"strsim",
|
"strsim",
|
||||||
|
"terminal_size",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1679,6 +1680,16 @@ dependencies = [
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "terminal_size"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7"
|
||||||
|
dependencies = [
|
||||||
|
"rustix",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.50"
|
version = "1.0.50"
|
||||||
|
|
|
@ -10,7 +10,7 @@ license = "MIT"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = { version = "0.4.31", features = ["serde"] }
|
chrono = { version = "0.4.31", features = ["serde"] }
|
||||||
clap = { version = "4.4.8", features = ["derive"] }
|
clap = { version = "4.4.11", features = ["derive", "wrap_help"] }
|
||||||
itertools = "0.12.0"
|
itertools = "0.12.0"
|
||||||
jsonschema = "0.17.1"
|
jsonschema = "0.17.1"
|
||||||
mediawiki = "0.2.11"
|
mediawiki = "0.2.11"
|
||||||
|
|
14
src/cli.rs
14
src/cli.rs
|
@ -8,8 +8,18 @@ use crate::{
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fn styles() -> clap::builder::styling::Styles {
|
||||||
|
use clap::builder::styling::{AnsiColor, Effects, Styles};
|
||||||
|
|
||||||
|
Styles::styled()
|
||||||
|
.header(AnsiColor::Yellow.on_default() | Effects::BOLD)
|
||||||
|
.usage(AnsiColor::Yellow.on_default() | Effects::BOLD)
|
||||||
|
.literal(AnsiColor::Green.on_default() | Effects::BOLD)
|
||||||
|
.placeholder(AnsiColor::Green.on_default())
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(clap::Parser, Clone, Debug, PartialEq, Eq)]
|
#[derive(clap::Parser, Clone, Debug, PartialEq, Eq)]
|
||||||
#[clap(name = "ludusavi", version, term_width = 79)]
|
#[clap(name = "ludusavi-manifest", version, max_term_width = 100, next_line_help = true, styles = styles())]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
pub sub: Subcommand,
|
pub sub: Subcommand,
|
||||||
|
@ -34,9 +44,11 @@ pub enum Subcommand {
|
||||||
},
|
},
|
||||||
/// Fetch a named subset of games.
|
/// Fetch a named subset of games.
|
||||||
Solo {
|
Solo {
|
||||||
|
/// Only use local data.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
local: bool,
|
local: bool,
|
||||||
|
|
||||||
|
/// Games to update, by wiki article title.
|
||||||
#[clap()]
|
#[clap()]
|
||||||
games: Vec<String>,
|
games: Vec<String>,
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue