Skip to content

Commit 69450c2

Browse files
committed
Add colors to --help
1 parent 43e3b10 commit 69450c2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/app.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use crate::substitution::Substitution;
2+
use clap::builder::Styles;
3+
use clap::builder::styling::{AnsiColor, Effects};
24
use clap::{Arg, Command};
35
use clap::{ArgAction, ValueHint, crate_version, value_parser};
46
use clap_complete::Shell;
@@ -11,11 +13,18 @@ fn parse_key_value_pair(value: &str) -> Result<(String, String), &'static str> {
1113
}
1214
}
1315

16+
const STYLES: Styles = Styles::styled()
17+
.header(AnsiColor::Green.on_default().effects(Effects::BOLD))
18+
.usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
19+
.literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
20+
.placeholder(AnsiColor::Cyan.on_default());
21+
1422
pub fn app() -> Command {
1523
Command::new("fblog")
1624
.version(crate_version!())
1725
.author("Brocode inc <bros@brocode.sh>")
1826
.about("json log viewer")
27+
.styles(STYLES)
1928
.arg(
2029
Arg::new("additional-value")
2130
.long("additional-value")

0 commit comments

Comments
 (0)