heraldurfave

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 3 Imported by: 0

README

herald-help/urfave

CI Go Reference License

urfave/cli adapter for herald-help - converts a cli.Command into a heraldhelp.Command for themed help rendering.

Installation

go get github.com/indaco/herald-help/urfave@latest

Quick Start

import (
    "io"
    "github.com/indaco/herald"
    heraldhelp "github.com/indaco/herald-help"
    heraldurfave "github.com/indaco/herald-help/urfave"
    "github.com/urfave/cli/v3"
)

// Override the global help printer with herald-themed output.
cli.HelpPrinter = func(w io.Writer, _ string, data any) {
    cmd, ok := data.(*cli.Command)
    if !ok {
        return
    }
    ty := herald.New()
    heraldhelp.RenderTo(w, ty, heraldurfave.FromUrfave(cmd))
}
// The default style is StyleCompact. Pass heraldhelp.WithStyle(heraldhelp.StyleRich),
// heraldhelp.WithStyle(heraldhelp.StyleGrouped), or heraldhelp.WithStyle(heraldhelp.StyleMarkdown)
// to RenderTo to use a different style.

What it extracts

urfave/cli field heraldhelp field Notes
Name Name
UsageText Synopsis
Description / Usage Description Prefers Description, falls back to Usage
Flags Flags / FlagGroups Grouped by category when categories are set
Flag Sources (env) Flag.EnvVars Environment variable bindings shown inline
Hidden flags Flag.Hidden Excluded by default, shown with WithShowHidden
Commands Commands / CommandGroups Grouped by category when categories are set
Hidden commands Excluded

See the main README for full rendering options and configuration.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Overview

Package heraldurfave converts a urfave/cli/v3 Command into a heraldhelp.Command for styled help rendering with herald.

Quick start:

app := &cli.Command{
    Name: "myapp",
    Action: func(ctx context.Context, cmd *cli.Command) error {
        ty := herald.New()
        return heraldhelp.RenderTo(cmd.Writer, ty, heraldurfave.FromUrfave(cmd))
    },
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromUrfave

func FromUrfave(cmd *cli.Command) heraldhelp.Command

FromUrfave converts a urfave/cli/v3 Command into a heraldhelp.Command. It extracts flags (with categories and env vars), subcommands (with categories), and other metadata.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL