Skip to content

Commit 156540e

Browse files
committed
feat: add colors to --help/-h
1 parent e33b3de commit 156540e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/atuin/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#![allow(clippy::use_self, clippy::missing_const_for_fn)] // not 100% reliable
33

44
use clap::Parser;
5+
use clap::builder::Styles;
6+
use clap::builder::styling::{AnsiColor, Effects};
57
use eyre::Result;
68

79
use command::AtuinCmd;
@@ -26,13 +28,20 @@ static HELP_TEMPLATE: &str = "\
2628
2729
{all-args}{after-help}";
2830

31+
const STYLES: Styles = Styles::styled()
32+
.header(AnsiColor::Yellow.on_default().effects(Effects::BOLD))
33+
.usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
34+
.literal(AnsiColor::Green.on_default().effects(Effects::BOLD))
35+
.placeholder(AnsiColor::Green.on_default());
36+
2937
/// Magical shell history
3038
#[derive(Parser)]
3139
#[command(
3240
author = "Ellie Huxtable <[email protected]>",
3341
version = VERSION,
3442
long_version = LONG_VERSION,
3543
help_template(HELP_TEMPLATE),
44+
styles = STYLES,
3645
)]
3746
struct Atuin {
3847
#[command(subcommand)]

0 commit comments

Comments
 (0)