From 6b0e9df40ebe645be4ed984cd9cce7b3029a07b6 Mon Sep 17 00:00:00 2001 From: Abeeujah <100226788+Abeeujah@users.noreply.github.com> Date: Thu, 3 Oct 2024 18:15:59 +0000 Subject: [PATCH 1/3] feat: Bring colors to help message --- cmd/soroban-cli/src/commands/global.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/soroban-cli/src/commands/global.rs b/cmd/soroban-cli/src/commands/global.rs index 9148e30cc..15b999d7d 100644 --- a/cmd/soroban-cli/src/commands/global.rs +++ b/cmd/soroban-cli/src/commands/global.rs @@ -1,11 +1,21 @@ -use clap::arg; +use clap::{ + arg, + builder::styling::{AnsiColor, Styles}, +}; use std::path::PathBuf; use super::config; +const USAGE_STYLES: Styles = Styles::styled() + .header(AnsiColor::Red.on_default().bold()) + .usage(AnsiColor::Red.on_default().bold()) + .literal(AnsiColor::Blue.on_default().bold()) + .placeholder(AnsiColor::Green.on_default()); + #[derive(Debug, clap::Args, Clone, Default)] #[group(skip)] #[allow(clippy::struct_excessive_bools)] +#[command(styles = USAGE_STYLES)] pub struct Args { #[clap(flatten)] pub locator: config::locator::Args, From f8a945444b7f5270d42b7784bef3da706d0bd5b9 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 4 Oct 2024 05:11:12 -0700 Subject: [PATCH 2/3] yellow-green --- cmd/soroban-cli/src/commands/global.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/soroban-cli/src/commands/global.rs b/cmd/soroban-cli/src/commands/global.rs index 15b999d7d..cf39f74e2 100644 --- a/cmd/soroban-cli/src/commands/global.rs +++ b/cmd/soroban-cli/src/commands/global.rs @@ -7,9 +7,9 @@ use std::path::PathBuf; use super::config; const USAGE_STYLES: Styles = Styles::styled() - .header(AnsiColor::Red.on_default().bold()) - .usage(AnsiColor::Red.on_default().bold()) - .literal(AnsiColor::Blue.on_default().bold()) + .header(AnsiColor::Yellow.on_default()) + .usage(AnsiColor::Green.on_default()) + .literal(AnsiColor::Green.on_default()) .placeholder(AnsiColor::Green.on_default()); #[derive(Debug, clap::Args, Clone, Default)] From ad1b43be9f78d6ec732aad9ae6ca6c584fc2f1bb Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 4 Oct 2024 22:24:54 +1000 Subject: [PATCH 3/3] use cargo styles --- cmd/soroban-cli/src/commands/global.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/soroban-cli/src/commands/global.rs b/cmd/soroban-cli/src/commands/global.rs index cf39f74e2..be883b6fd 100644 --- a/cmd/soroban-cli/src/commands/global.rs +++ b/cmd/soroban-cli/src/commands/global.rs @@ -1,16 +1,19 @@ use clap::{ arg, - builder::styling::{AnsiColor, Styles}, + builder::styling::{AnsiColor, Effects, Styles}, }; use std::path::PathBuf; use super::config; const USAGE_STYLES: Styles = Styles::styled() - .header(AnsiColor::Yellow.on_default()) - .usage(AnsiColor::Green.on_default()) - .literal(AnsiColor::Green.on_default()) - .placeholder(AnsiColor::Green.on_default()); + .header(AnsiColor::Green.on_default().effects(Effects::BOLD)) + .usage(AnsiColor::Green.on_default().effects(Effects::BOLD)) + .literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD)) + .placeholder(AnsiColor::Cyan.on_default().effects(Effects::BOLD)) + .error(AnsiColor::Red.on_default().effects(Effects::BOLD)) + .valid(AnsiColor::Cyan.on_default().effects(Effects::BOLD)) + .invalid(AnsiColor::Yellow.on_default().effects(Effects::BOLD)); #[derive(Debug, clap::Args, Clone, Default)] #[group(skip)]