Skip to content

Commit

Permalink
mcu-util: add colors (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed Jun 17, 2024
1 parent 7b31302 commit c60d813
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions mcu-util/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use std::io::Write;
use std::path::PathBuf;
use std::time::Duration;

use clap::Parser;
use clap::{
builder::{styling::AnsiColor, Styles},
Parser,
};
use color_eyre::eyre::{Context, Result};
use orb_build_info::{make_build_info, BuildInfo};
use tracing::{debug, error};
Expand All @@ -22,7 +25,8 @@ static BUILD_INFO: BuildInfo = make_build_info!();
author,
version = BUILD_INFO.version,
about = "Orb MCU utility",
long_about = "Debug microcontrollers and manage firmware images"
long_about = "Debug microcontrollers and manage firmware images",
styles = clap_v3_styles(),
)]
struct Args {
#[clap(subcommand)]
Expand Down Expand Up @@ -196,6 +200,14 @@ async fn execute(args: Args) -> Result<()> {
}
}

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

#[tokio::main]
async fn main() -> Result<()> {
color_eyre::install()?;
Expand Down

0 comments on commit c60d813

Please sign in to comment.