From 457bfeda119487e41a2865b261e14842fc79490c Mon Sep 17 00:00:00 2001 From: Petr Gadorek Date: Tue, 16 Jul 2024 12:00:50 +0200 Subject: [PATCH] new windows path modifications --- Cargo.toml | 2 +- src/cli_args/mod.rs | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f457453..8a1befc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] tokio = {version = "1.37.0", features=["full"]} idf-im-lib = { git = "https://github.com/espressif/idf-im-lib.git", branch="master" } -clap = {version = "4.5", features = ["cargo", "derive"]} +clap = {version = "4.5", features = ["cargo", "derive", "color"]} crossterm = "0.27.0" dialoguer = { git = "https://github.com/Hahihula/dialoguer.git", branch = "folder-select", features = ["folder-select"] } byte-unit = "5.1.4" diff --git a/src/cli_args/mod.rs b/src/cli_args/mod.rs index ea171cd..ae5034a 100644 --- a/src/cli_args/mod.rs +++ b/src/cli_args/mod.rs @@ -1,5 +1,6 @@ -use clap::Parser; -use clap::{arg, ValueEnum}; +use clap::builder::styling::{AnsiColor, Color, Style, Styles}; +use clap::CommandFactory; +use clap::{arg, command, value_parser, ColorChoice, Parser, ValueEnum}; use config::{Config, ConfigError, File}; use log::{debug, error, info}; use serde::{Deserialize, Serialize}; @@ -28,12 +29,31 @@ pub struct Settings { pub idf_mirror: Option, } +fn custom_styles() -> Styles { + Styles::styled() + .header( + Style::new() + .bold() + .underline() + .fg_color(Some(Color::Ansi(AnsiColor::Yellow))), + ) + .usage( + Style::new() + .bold() + .fg_color(Some(Color::Ansi(AnsiColor::Green))), + ) + .literal(Style::new().fg_color(Some(Color::Ansi(AnsiColor::Magenta)))) + .placeholder(Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red)))) +} + #[derive(Parser, Debug)] #[command( author, version = VERSION, about = "ESP-IDF Install Manager", - long_about = "All you need to manage your ESP-IDF installations" + long_about = "All you need to manage your ESP-IDF installations", + color = ColorChoice::Always, + styles = custom_styles() )] pub struct Cli { #[arg(short, long, value_name = "FILE")]