Skip to content

Commit 0b74316

Browse files
lu-zerobarrbrain
authored andcommitted
Use the clap v3 style
1 parent 09a4111 commit 0b74316

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/bin/common.rs

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use crate::error::*;
1111
use crate::muxer::{create_muxer, Muxer};
1212
use crate::stats::MetricsEnabled;
13+
use clap::builder::styling::AnsiColor;
14+
use clap::builder::Styles;
1315
use clap::{CommandFactory, Parser as Clap, Subcommand};
1416
use clap_complete::{generate, Shell};
1517
use rav1e::prelude::*;
@@ -30,6 +32,7 @@ pub mod built_info {
3032
#[derive(Clap)]
3133
#[clap(
3234
name = "rav1e",
35+
styles = get_styles(),
3336
version = get_version(),
3437
long_version = get_long_version(),
3538
about = "AV1 video encoder",
@@ -260,6 +263,14 @@ pub struct CliOptions {
260263
static VERSION_STR: OnceLock<String> = OnceLock::new();
261264
static LONG_VERSION_STR: OnceLock<String> = OnceLock::new();
262265

266+
fn get_styles() -> Styles {
267+
Styles::styled()
268+
.header(AnsiColor::Yellow.on_default())
269+
.usage(AnsiColor::Green.on_default())
270+
.literal(AnsiColor::Green.on_default())
271+
.placeholder(AnsiColor::Green.on_default())
272+
}
273+
263274
fn get_version() -> &'static str {
264275
VERSION_STR.get_or_init(|| {
265276
format!(

0 commit comments

Comments
 (0)