SuperCLI
Universal CLI output wrapper around starbase-styles for consistent CLI theming across tools.
Overview
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.
Features
- 🎨 Semantic CLI Output Macros - success!, warning!, info!, error!
- 🎯 Fine-Grained Styling Control - styled! macro for mixing styles
- 🎛️ Output Mode Management - color/monochrome/none with environment variables
- 🌈 Theme-Aware Output - automatically adapts to light/dark terminals
- ✅ 100% starbase-styles compatibility - enhanced convenience methods
- 🚀 Zero-dependency core - only requires starbase-styles
- 🔧 Optional clap integration - enhanced help styling
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
# With clap integration
= { = "0.1.0", = ["clap"] }
Quick Start
Basic Usage
use *;
// Semantic output macros
success!;
warning!;
info!;
error!;
// Fine-grained styling control
styled!;
// Use starbase-styles functions directly
println!;
Advanced Styling
use *;
// Mix multiple styled components in one line
styled!;
// Chain different style types
styled!;
Environment Control
SuperCLI respects standard environment variables and adds its own:
# Disable colors completely (NO_COLOR standard)
# Force monochrome output
# Disable all output styling
# Force color output (override detection)
Clap Integration
When using the clap feature, SuperCLI enhances command-line argument parsing:
use create_help_styles;
use Parser;
Semantic Style Types
SuperCLI supports all starbase-styles semantic types:
Status Styles
success- Success messages (green)warning- Warning messages (yellow)error- Error messages (red)info- Informational messages (blue)
Data Styles
number- Numeric valuesfile_path- File and directory pathsurl- Web URLsemail- Email addressesid- Identifiers and IDshash- Hash valuestoken- Tokens and keys
UI Styles
property- Property namesvalue- Property valuessymbol- Icons and symbolsmuted- Dimmed texthighlight- Highlighted text
Output Modes
SuperCLI automatically detects the best output mode:
- Color Mode: Full color output when terminal supports it
- Monochrome Mode: Black and white styling for limited terminals
- None Mode: Plain text with no styling
Detection considers:
- Terminal capabilities
- Environment variables (NO_COLOR, TERM, etc.)
- User preferences (GUARDY_OUTPUT_STYLE)
API Reference
Macros
success!(message, ...)
Display success message with checkmark symbol.
success!;
success!;
warning!(message, ...)
Display warning message with warning symbol.
warning!;
warning!;
info!(message, ...)
Display informational message with info symbol.
info!;
info!;
error!(message, ...)
Display error message with error symbol.
error!;
error!;
styled!(format, (value, style), ...)
Fine-grained styling control with multiple style parameters.
styled!;
Examples
CLI Progress Output
use *;
info!;
styled!;
styled!;
warning!;
success!;
Configuration Display
use *;
info!;
styled!;
styled!;
styled!;
styled!;
Error Reporting
use *;
error!;
styled!;
styled!;
styled!;
info!;
Integration with Other Tools
SuperCLI works well with popular CLI libraries:
- clap: Enhanced help styling (built-in feature)
- indicatif: Progress bars with consistent theming
- dialoguer: Prompts that match your CLI style
- console: Terminal utilities with color coordination
Performance
SuperCLI is designed for minimal overhead:
- Zero-cost abstractions where possible
- Lazy evaluation of styling
- Minimal allocations
- Fast terminal capability detection
Typical overhead is <1ms per styled output operation.
License
MIT License - see LICENSE for details.
Contributing
Contributions welcome! Please see CONTRIBUTING.md for guidelines.
Support
- 📚 Documentation
- 🐛 Issues
- 💬 Discussions