Skip to content

Commit

Permalink
Use the clap v3 style
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero authored and barrbrain committed Oct 15, 2024
1 parent 09a4111 commit 0b74316
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/bin/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use crate::error::*;
use crate::muxer::{create_muxer, Muxer};
use crate::stats::MetricsEnabled;
use clap::builder::styling::AnsiColor;
use clap::builder::Styles;
use clap::{CommandFactory, Parser as Clap, Subcommand};
use clap_complete::{generate, Shell};
use rav1e::prelude::*;
Expand All @@ -30,6 +32,7 @@ pub mod built_info {
#[derive(Clap)]
#[clap(
name = "rav1e",
styles = get_styles(),
version = get_version(),
long_version = get_long_version(),
about = "AV1 video encoder",
Expand Down Expand Up @@ -260,6 +263,14 @@ pub struct CliOptions {
static VERSION_STR: OnceLock<String> = OnceLock::new();
static LONG_VERSION_STR: OnceLock<String> = OnceLock::new();

fn get_styles() -> Styles {
Styles::styled()
.header(AnsiColor::Yellow.on_default())
.usage(AnsiColor::Green.on_default())
.literal(AnsiColor::Green.on_default())
.placeholder(AnsiColor::Green.on_default())
}

fn get_version() -> &'static str {
VERSION_STR.get_or_init(|| {
format!(
Expand Down

0 comments on commit 0b74316

Please sign in to comment.