Documentation
¶
Index ¶
- Variables
- func AddSpacing(compact bool)
- func ModernHelpFuncPterm(cmd *cobra.Command, args []string)
- func RenderCommands(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
- func RenderDescription(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
- func RenderExamples(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
- func RenderFlags(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
- func RenderFooter(cmd *cobra.Command, config *HelpUIConfig)
- func RenderHeader(cmd *cobra.Command, config *HelpUIConfig)
- func RenderSectionHeader(title string, config *HelpUIConfig)
- func RenderUsage(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
- type HelpUIConfig
- type TextFormatter
Constants ¶
This section is empty.
Variables ¶
var DefaultHelpConfig = HelpUIConfig{ MaxLineWidth: 78, IndentSize: 2, SectionColor: pterm.FgCyan, CommandColor: pterm.FgMagenta, FlagNameColor: pterm.FgGreen, FlagTypeColor: pterm.FgBlue, DefaultColor: pterm.FgYellow, TextColor: pterm.FgLightCyan, ExampleColor: pterm.FgMagenta, BorderStyle: *pterm.NewStyle(pterm.FgGray), CompactSpacing: true, }
DefaultHelpConfig: Optimized color scheme with soft cyan for body text Yellow is strictly limited to single default value keywords (no block usage)
Functions ¶
func ModernHelpFuncPterm ¶
ModernHelpFuncPterm is the main modular help renderer with eye-friendly design Core features: soft cyan block text, yellow limited to single keywords, compact layout
func RenderCommands ¶
func RenderCommands(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
RenderCommands renders subcommands (magenta for names, soft cyan for descriptions)
func RenderDescription ¶
func RenderDescription(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
RenderDescription renders the long description (soft cyan for block text)
func RenderExamples ¶
func RenderExamples(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
RenderExamples renders examples (magenta for commands, soft cyan for comments)
func RenderFlags ¶
func RenderFlags(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
RenderFlags renders flags (yellow only for default value keywords)
func RenderFooter ¶
func RenderFooter(cmd *cobra.Command, config *HelpUIConfig)
RenderFooter renders the final help instruction (soft cyan for readability)
func RenderHeader ¶
func RenderHeader(cmd *cobra.Command, config *HelpUIConfig)
RenderHeader renders the main header with clean style (no yellow)
func RenderSectionHeader ¶
func RenderSectionHeader(title string, config *HelpUIConfig)
RenderSectionHeader renders consistent, scannable section headers
func RenderUsage ¶
func RenderUsage(cmd *cobra.Command, config *HelpUIConfig, formatter *TextFormatter)
RenderUsage renders the usage section (no yellow, green for syntax highlight)
Types ¶
type HelpUIConfig ¶
type HelpUIConfig struct {
MaxLineWidth int // Maximum line length for text wrapping
IndentSize int // Base indentation size
SectionColor pterm.Color // Color for section headers (highlighted)
CommandColor pterm.Color // Color for command names
FlagNameColor pterm.Color // Color for flag names
FlagTypeColor pterm.Color // Color for flag types
DefaultColor pterm.Color // Color for default values (single keyword only)
TextColor pterm.Color // Color for body text (soft cyan, eye-friendly)
ExampleColor pterm.Color // Color for example commands
BorderStyle pterm.Style // Style for section borders (subtle, low visibility)
CompactSpacing bool // Enable compact spacing mode to save space
}
-------------------------- Configuration (Core Optimization: White → Soft Cyan for Eye Comfort & Clarity) --------------------------
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
-------------------------- Text Formatter (Modular Wrapping Logic) --------------------------
func NewTextFormatter ¶
func NewTextFormatter(config *HelpUIConfig) *TextFormatter
NewTextFormatter creates a TextFormatter instance with specified config