Skip to content

Commit

Permalink
feat(cli): Add colors to help texts (#1007)
Browse files Browse the repository at this point in the history
Co-authored-by: simonsan <[email protected]>
  • Loading branch information
aawsome and simonsan committed Jan 28, 2024
1 parent 08bcc7a commit 9a41c74
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ use abscissa_core::{
FrameworkErrorKind, Runnable, Shutdown,
};
use anyhow::{anyhow, Result};
use clap::builder::{
styling::{AnsiColor, Effects},
Styles,
};
use dialoguer::Password;
use log::{log, Level};
use rustic_core::{OpenStatus, Repository};
Expand Down Expand Up @@ -126,9 +130,17 @@ enum RusticCmd {
Tag(TagCmd),
}

fn styles() -> Styles {
Styles::styled()
.header(AnsiColor::Red.on_default() | Effects::BOLD)
.usage(AnsiColor::Red.on_default() | Effects::BOLD)
.literal(AnsiColor::Blue.on_default() | Effects::BOLD)
.placeholder(AnsiColor::Green.on_default())
}

/// Entry point for the application. It needs to be a struct to allow using subcommands!
#[derive(clap::Parser, Command, Debug)]
#[command(author, about, name="rustic", version = option_env!("PROJECT_VERSION").unwrap_or(env!("CARGO_PKG_VERSION")))]
#[command(author, about, name="rustic", styles=styles(), version = option_env!("PROJECT_VERSION").unwrap_or(env!("CARGO_PKG_VERSION")))]
pub struct EntryPoint {
#[command(flatten)]
pub config: RusticConfig,
Expand Down

0 comments on commit 9a41c74

Please sign in to comment.