|
2 | 2 |
|
3 | 3 | use std::path::PathBuf; |
4 | 4 |
|
| 5 | +use clap::builder::styling::{Color, RgbColor, Style, Styles}; |
5 | 6 | use clap::{Args, Parser, Subcommand}; |
6 | 7 | use mosskeys_core::{Client, Config}; |
7 | 8 |
|
8 | 9 | use crate::output::Reporter; |
9 | 10 |
|
10 | | -/// MossKeys — publish public key material and sign checkpoints locally (BYOK). |
| 11 | +/// Brand-aligned help styles, mirroring the terminal theme (see `theme.rs`): |
| 12 | +/// section headers and usage in emerald, commands/flags (the tokens you type) |
| 13 | +/// in bright emerald, and argument placeholders in cyber cyan. clap only paints |
| 14 | +/// these on a TTY and honours `NO_COLOR`, so pipes and CI stay plain. |
| 15 | +const fn help_styles() -> Styles { |
| 16 | + // Sampled from the web design system's dark-mode shades, identical to the |
| 17 | + // palette in `theme.rs`. |
| 18 | + const BRAND: Color = Color::Rgb(RgbColor(52, 211, 153)); // brand-400 / emerald |
| 19 | + const BRAND_LIGHT: Color = Color::Rgb(RgbColor(110, 231, 183)); // emerald-300 |
| 20 | + const CYBER: Color = Color::Rgb(RgbColor(34, 211, 238)); // cyber-400 |
| 21 | + const DANGER: Color = Color::Rgb(RgbColor(252, 165, 165)); // red-300 |
| 22 | + |
| 23 | + Styles::styled() |
| 24 | + .header(Style::new().bold().underline().fg_color(Some(BRAND))) |
| 25 | + .usage(Style::new().bold().underline().fg_color(Some(BRAND))) |
| 26 | + .literal(Style::new().bold().fg_color(Some(BRAND_LIGHT))) |
| 27 | + .placeholder(Style::new().fg_color(Some(CYBER))) |
| 28 | + .valid(Style::new().fg_color(Some(BRAND_LIGHT))) |
| 29 | + .invalid(Style::new().bold().fg_color(Some(DANGER))) |
| 30 | + .error(Style::new().bold().fg_color(Some(DANGER))) |
| 31 | +} |
| 32 | + |
| 33 | +/// mosskeys — publish public key material and sign checkpoints locally (BYOK). |
11 | 34 | #[derive(Debug, Parser)] |
12 | | -#[command(name = "mosskeys", version, about, long_about = None)] |
| 35 | +#[command( |
| 36 | + name = "mosskeys", |
| 37 | + version, |
| 38 | + about, |
| 39 | + long_about = None, |
| 40 | + next_line_help = true, |
| 41 | + max_term_width = 100, |
| 42 | + styles = help_styles() |
| 43 | +)] |
13 | 44 | pub struct Cli { |
14 | 45 | #[command(flatten)] |
15 | 46 | pub global: GlobalArgs, |
|
0 commit comments