Crates.io | supercli |
lib.rs | supercli |
version | 0.1.0 |
created_at | 2025-08-22 11:41:40.773869+00 |
updated_at | 2025-08-22 11:41:40.773869+00 |
description | Universal CLI output wrapper around starbase-styles for consistent CLI theming across tools |
homepage | https://github.com/deepbrainspace/guardy |
repository | https://github.com/deepbrainspace/guardy |
max_upload_size | |
id | 1806219 |
size | 47,943 |
Universal CLI output wrapper around starbase-styles for consistent CLI theming across tools.
SuperCLI wraps starbase-styles to provide consistent, semantic CLI output patterns across all your command-line tools while maintaining full compatibility with the underlying starbase styling system.
Add to your Cargo.toml
:
[dependencies]
supercli = "0.1.0"
# With clap integration
supercli = { version = "0.1.0", features = ["clap"] }
use supercli::prelude::*;
// Semantic output macros
success!("Operation completed successfully!");
warning!("This action cannot be undone");
info!("Processing files...");
error!("Configuration file not found");
// Fine-grained styling control
styled!("Processing {} files in {}",
("150", "number"),
("/home/user", "file_path")
);
// Use starbase-styles functions directly
println!("Found {}", file("config.toml"));
use supercli::prelude::*;
// Mix multiple styled components in one line
styled!("{} Found {} secrets in {} files ({})",
("🔍", "info_symbol"),
("5", "error_count"),
("127", "file_count"),
("2.3s", "duration")
);
// Chain different style types
styled!("Status: {} | Progress: {} | ETA: {}",
("✅ Complete", "success"),
("87%", "progress"),
("1m 23s", "muted")
);
SuperCLI respects standard environment variables and adds its own:
# Disable colors completely (NO_COLOR standard)
export NO_COLOR=1
# Force monochrome output
export GUARDY_OUTPUT_STYLE=monochrome
# Disable all output styling
export GUARDY_OUTPUT_STYLE=none
# Force color output (override detection)
export GUARDY_OUTPUT_STYLE=color
When using the clap
feature, SuperCLI enhances command-line argument parsing:
use supercli::clap::create_help_styles;
use clap::Parser;
#[derive(Parser)]
#[command(
name = "my-tool",
about = "My awesome CLI tool",
styles = create_help_styles() // Enhanced help styling
)]
struct Cli {
/// Enable verbose output
#[arg(short, long)]
verbose: bool,
/// Configuration file path
#[arg(short, long, default_value = "config.yaml")]
config: String,
}
fn main() {
let cli = Cli::parse();
if cli.verbose {
info!("Verbose mode enabled");
}
styled!("Using config file: {}", (cli.config, "file_path"));
}
SuperCLI supports all starbase-styles semantic types:
success
- Success messages (green)warning
- Warning messages (yellow)error
- Error messages (red)info
- Informational messages (blue)number
- Numeric valuesfile_path
- File and directory pathsurl
- Web URLsemail
- Email addressesid
- Identifiers and IDshash
- Hash valuestoken
- Tokens and keysproperty
- Property namesvalue
- Property valuessymbol
- Icons and symbolsmuted
- Dimmed texthighlight
- Highlighted textSuperCLI automatically detects the best output mode:
Detection considers:
success!(message, ...)
Display success message with checkmark symbol.
success!("Build completed successfully!");
success!("Processed {} files", 42);
warning!(message, ...)
Display warning message with warning symbol.
warning!("This action cannot be undone");
warning!("Found {} deprecated functions", count);
info!(message, ...)
Display informational message with info symbol.
info!("Starting deployment process...");
info!("Using {} workers", num_workers);
error!(message, ...)
Display error message with error symbol.
error!("Configuration file not found");
error!("Failed to connect to {}", server);
styled!(format, (value, style), ...)
Fine-grained styling control with multiple style parameters.
styled!("Found {} issues in {} files",
("3", "error_count"),
("src/main.rs", "file_path")
);
use supercli::prelude::*;
info!("Starting file scan...");
styled!("📁 Scanning {} ({} files)",
("src/", "file_path"),
("1,247", "number")
);
styled!("🔍 Found {} secrets in {} files",
("5", "error_count"),
("3", "file_count")
);
warning!("2 files contain potential secrets");
success!("Scan completed in 1.3s");
use supercli::prelude::*;
info!("Configuration loaded:");
styled!(" Database: {}", ("postgresql://localhost", "url"));
styled!(" Max connections: {}", ("100", "number"));
styled!(" Debug mode: {}", ("enabled", "success"));
styled!(" Log level: {}", ("info", "property"));
use supercli::prelude::*;
error!("Validation failed");
styled!(" File: {}", ("config.yaml:23", "file_path"));
styled!(" Error: {}", ("Invalid email format", "error"));
styled!(" Value: {}", ("not-an-email", "value"));
info!("Tip: Use format user@domain.com");
SuperCLI works well with popular CLI libraries:
SuperCLI is designed for minimal overhead:
Typical overhead is <1ms per styled output operation.
MIT License - see LICENSE for details.
Contributions welcome! Please see CONTRIBUTING.md for guidelines.