This document provides guidelines for creating consistent, well-structured CLI output across the A.R.C. CLI application.
arc/
├── cmd/arc/ # Application entry point
│ └── main.go
├── internal/ # Private application code
│ ├── branding/ # Branding constants (name, tagline)
│ ├── state/ # State management (persisted settings)
│ └── version/ # Version information
├── pkg/ # Public reusable packages
│ ├── cli/ # CLI commands
│ │ ├── banner.go # Banner rendering
│ │ ├── help.go # Help formatting
│ │ ├── root.go # Root command
│ │ └── theme.go # Theme management
│ └── ui/ # User interface components
│ ├── layout/ # Layout system for structured output
│ ├── styles/ # Styling (colors, emoji, output)
│ └── themes/ # Color themes
└── docs/ # Documentation
The layout system provides consistent, structured output rendering.
Key Components:
Component- Individual UI elements (title, description, content, emoji)Section- Logical grouping of componentsLayout- Container for multiple sections
Example Usage:
import "github.com/arc-framework/arc-cli/pkg/ui/layout"
// Create a layout
l := layout.NewLayout()
// Add a section with heading
section := l.AddSection("Commands", true) // true = show border
// Add items to section
section.AddItem("🚀", "deploy", "Deploy your application")
section.AddItem("📊", "status", "Check deployment status")
// Add code snippet
section.AddCodeSnippet("Example", "arc deploy --env production")
// Render
fmt.Print(l.Render())Output:
Commands
────────
🚀 deploy
Deploy your application
📊 status
Check deployment status
📦 Example
arc deploy --env production
Centralized styling and output functions.
Available Styles:
PrimaryStyle- Main brand color (cyan)SecondaryStyle- Secondary text (gray)SuccessStyle- Success messages (green)ErrorStyle- Error messages (red)WarningStyle- Warning messages (orange)InfoStyle- Info messages (purple)
Output Functions:
import "github.com/arc-framework/arc-cli/pkg/ui/styles"
styles.Success("Deployment completed!")
styles.Error("Failed to connect to server")
styles.Warn("This action will overwrite existing files")
styles.Info("Fetching latest updates...")
styles.Debug("Connection timeout: 30s")Emoji Constants:
styles.EmojiBrand // 🌀 Brand logo
styles.EmojiSuccess // ✅ Successful operations
styles.EmojiError // ❌ Errors
styles.EmojiWarning // ⚠️ Warnings
styles.EmojiInfo // ℹ️ Information
styles.EmojiDeploy // 🚀 Deploy/Launch
styles.EmojiInspect // 🔍 Inspect/Debug
styles.EmojiBox // 📦 Resources/Containers
styles.EmojiAgent // 🤖 AI agent output
styles.EmojiWait // ⏳ Loading/ProcessingColor theme management for banner customization.
Available Themes:
cyan-purple(default) - Professional gradientrainbow- Full spectrumfire- Yellow to redocean- Cool bluesmatrix- Green hacker stylecharacter-rainbow- Character-level coloring
Usage:
import "github.com/arc-framework/arc-cli/pkg/ui/themes"
// Get all themes
allThemes := themes.Available()
// Get default theme
defaultTheme := themes.GetDefault()
// Get rainbow colors for special effects
colors := themes.Rainbow()items := []string{
"Initialize project",
"Install dependencies",
"Run tests",
}
output := layout.List(styles.EmojiSuccess, items)
fmt.Print(output)Output:
✅ Initialize project
✅ Install dependencies
✅ Run tests
title := "Deploy Command"
description := "Deploy your application to production"
commands := map[string]string{
"arc deploy": "Deploy with default settings",
"arc deploy --env prod": "Deploy to production",
"arc deploy --dry-run": "Test deployment without changes",
}
examples := []string{
"arc deploy --env staging",
"arc deploy --env production --verbose",
}
help := layout.RenderHelp(title, description, commands, examples)
fmt.Print(help)title := "Important Notice"
content := "Your API keys will expire in 7 days.\nPlease renew them in the dashboard."
boxed := layout.Box(title, content)
fmt.Print(boxed)Output:
╭─────────────────────────────╮
│ │
│ Important Notice │
│ │
│ Your API keys will expire │
│ in 7 days. Please renew │
│ them in the dashboard. │
│ │
╰─────────────────────────────╯
headers := []string{"Name", "Status", "Uptime"}
rows := [][]string{
{"api-server", "running", "5d 3h"},
{"database", "running", "12d 8h"},
{"cache", "stopped", "0m"},
}
table := layout.Table(headers, rows)
fmt.Print(table)Output:
Name Status Uptime
──────────────────────────────────────
api-server running 5d 3h
database running 12d 8h
cache stopped 0m
Always use predefined emoji constants from styles package:
✅ Good:
styles.Info("Deploying application...")
fmt.Printf("%s Starting deployment\n", styles.EmojiDeploy)❌ Bad:
fmt.Println("🚀 Starting deployment") // Hardcoded emojiUse semantic color styles based on message type:
✅ Good:
styles.Success("Build completed")
styles.Error("Connection failed")
styles.Warn("Deprecated feature")❌ Bad:
fmt.Println(styles.PrimaryStyle.Render("Error occurred")) // Wrong styleUse layout system for complex output:
✅ Good:
l := layout.NewLayout()
section := l.AddSection("Results", true)
section.AddItem(styles.EmojiSuccess, "Test 1", "Passed")
fmt.Print(l.Render())❌ Bad:
fmt.Println("Results")
fmt.Println("-------")
fmt.Println("✅ Test 1: Passed") // Manual formattingAlways check styles.NoColor for colored output:
✅ Good:
if !styles.NoColor {
fmt.Println(styles.SuccessStyle.Render("Success"))
} else {
fmt.Println("Success")
}Or use the output functions that handle this automatically:
styles.Success("Success") // Automatically respects NoColorfunc executeCommand() error {
styles.Info("Starting operation...")
// Do work
if err := doWork(); err != nil {
styles.Error("Operation failed: %v", err)
return err
}
styles.Success("Operation completed!")
return nil
}func showResults(items []Item) {
l := layout.NewLayout()
section := l.AddSection("Results", true)
for _, item := range items {
emoji := styles.EmojiSuccess
if !item.Success {
emoji = styles.EmojiError
}
section.AddItem(emoji, item.Name, item.Status)
}
fmt.Print(l.Render())
}func showProgress(current, total int) {
percentage := (current * 100) / total
styles.Info("Progress: %d%% (%d/%d)", percentage, current, total)
}- Always provide text alternatives for emoji
- Support
--no-colorflag for terminal compatibility - Use clear, descriptive text
- Maintain proper contrast ratios
- Test on different terminal backgrounds
See pkg/cli/theme.go for a complete example of using the layout system for theme commands.
- Interactive prompts (Bubble Tea integration)
- Progress bars
- Spinner animations
- Multi-column layouts
- Markdown rendering