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

Colorfull help #13

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 23 additions & 3 deletions src/cli_args/mod.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -28,12 +29,31 @@ pub struct Settings {
pub idf_mirror: Option<String>,
}

fn custom_styles() -> Styles {
Styles::styled()
.header(
Style::new()
.bold()
.underline()
.fg_color(Some(Color::Ansi(AnsiColor::Green))),
)
.usage(
Style::new()
.bold()
.fg_color(Some(Color::Ansi(AnsiColor::Green))),
)
.literal(Style::new().fg_color(Some(Color::Ansi(AnsiColor::Cyan))))
.placeholder(Style::new().fg_color(Some(Color::Ansi(AnsiColor::Blue))))
}

#[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")]
Expand Down
Loading