Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the clap v3 style #3401

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
#[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 @@
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())
}

Check warning on line 272 in src/bin/common.rs

View check run for this annotation

Codecov / codecov/patch

src/bin/common.rs#L266-L272

Added lines #L266 - L272 were not covered by tests

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