feat(cli): add better styles

This commit is contained in:
daimond113 2024-12-01 13:31:30 +01:00
parent 11a356c99a
commit e807c261a2
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
2 changed files with 14 additions and 3 deletions

View file

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Add improved CLI styling by @daimond113
## [0.5.0-rc.14] - 2024-11-30 ## [0.5.0-rc.14] - 2024-11-30
### Fixed ### Fixed
- Fix `includes` not supporting root files by @daimond113 - Fix `includes` not supporting root files by @daimond113

View file

@ -2,7 +2,7 @@
use crate::cli::version::{check_for_updates, get_or_download_version}; use crate::cli::version::{check_for_updates, get_or_download_version};
use crate::cli::{auth::get_tokens, display_err, home_dir, HOME_DIR}; use crate::cli::{auth::get_tokens, display_err, home_dir, HOME_DIR};
use anyhow::Context; use anyhow::Context;
use clap::Parser; use clap::{builder::styling::AnsiColor, Parser};
use fs_err::tokio as fs; use fs_err::tokio as fs;
use indicatif::MultiProgress; use indicatif::MultiProgress;
use indicatif_log_bridge::LogWrapper; use indicatif_log_bridge::LogWrapper;
@ -16,12 +16,19 @@ use tempfile::NamedTempFile;
mod cli; mod cli;
pub mod util; pub mod util;
const STYLES: clap::builder::Styles = clap::builder::Styles::styled()
.header(AnsiColor::Yellow.on_default().underline())
.usage(AnsiColor::Yellow.on_default().underline())
.literal(AnsiColor::Green.on_default().bold())
.placeholder(AnsiColor::Cyan.on_default());
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[clap( #[clap(
version, version,
about = "A package manager for the Luau programming language, supporting multiple runtimes including Roblox and Lune" about = "A package manager for the Luau programming language",
long_about = "A package manager for the Luau programming language, supporting multiple runtimes including Roblox and Lune"
)] )]
#[command(disable_version_flag = true)] #[command(disable_version_flag = true, styles = STYLES)]
struct Cli { struct Cli {
/// Print version /// Print version
#[arg(short = 'v', short_alias = 'V', long, action = clap::builder::ArgAction::Version)] #[arg(short = 'v', short_alias = 'V', long, action = clap::builder::ArgAction::Version)]