Expand description
A production-ready crate for adding colorful version output to clap applications.
This crate provides utilities to override the default -V/--version flag behavior
in clap applications with colorful output using hex color codes.
§Examples
§Basic usage with derive
use clap::Parser;
use clap_version_flag::colorful_version;
#[derive(Parser)]
#[command(name = "myapp")]
struct Cli {
#[arg(short, long)]
input: String,
}
fn main() {
let version = colorful_version!();
let cli = Cli::parse();
// Check version flag manually if needed
// version.print(); // This would print colored version
}§Using with custom colors
use clap_version_flag::colorful_version;
let version = colorful_version!("#FF0000", "#0000FF", "#00FF00", "#FFFF00");
version.print();Modules§
- macros
- Macros for creating and working with
ColorfulVersion
Macros§
- colorful_
version - Main macro for easy creation of ColorfulVersion from Cargo.toml
- colorful_
version_ full - Macro to create a colorful version with complete configuration
- colorful_
version_ rgb - Macro to create a colorful version with RGB colors
Structs§
- Colorful
Version - Configuration for colorful version output
Enums§
- Version
Error - Error type for clap-version-flag
Traits§
- Colorful
Version Ext - Extension trait for clap::Command to add colorful version flag
Functions§
- parse_
with_ version - Helper function to parse command-line arguments with version handling