func (x Command) Help() string {
	var buf string
	buf += util.Emph("**NAME**", 0, -1) + "\n       " + x.Title() + "\n\n"
	buf += util.Emph("**SYNOPSIS**", 0, -1) + "\n       " + x.Name + " " + x.Usage + "\n\n"
	if len(x.Commands.M) > 0 {
		buf += util.Emph("**COMMANDS**", 0, -1) + "\n" + x.Titles(7, 20) + "\n\n"
	}
	if len(x.Description) > 0 {
		buf +=
			util.Emph("**DESCRIPTION**", 0, -1) + "\n" +
				util.Emph(x.Description, 7, 65) + "\n\n"
	}
	if x.Source != "" || x.Issues != "" || x.Site != "" {
		buf += util.Emph("**LINKS**", 0, -1) + "\n"
		if x.Site != "" {
			buf += "       Site:   " + x.Site + "\n"
		}
		if x.Source != "" {
			buf += "       Source: " + x.Source + "\n"
		}
		if x.Issues != "" {
			buf += "       Issues: " + x.Issues + "\n"
		}
		buf += "\n"
	}
	if x.Copyright != "" {
		buf += util.Emph("**LEGAL**", 0, -1) + "\n" + util.Indent(x.Legal(), 7) + "\n\n"
	}
	return buf
}
------------------------------- help -------------------------------
Help returns a formatted string suitable for printing either to
a file or to an interactive terminal. For a more structured form of
the same information see YAML, JSON, Print, and PrintHelp.
package cmdbox
import (
	"fmt"
	"strings"
	"sync"
	"github.com/rwxrob/cmdbox/util"
	"github.com/rwxrob/cmdbox/valid"
)
type Command struct {
	Name        string          `json:"name,omitempty" yaml:",omitempty"`
	Summary     string          `json:"summary,omitempty" yaml:",omitempty"`
	Usage       string          `json:"usage,omitempty" yaml:",omitempty"`
	Version     string          `json:"version,omitempty" yaml:",omitempty"`
	Copyright   string          `json:"copyright,omitempty" yaml:",omitempty"`
	License     string          `json:"license,omitempty" yaml:",omitempty"`
	Description string          `json:"description,omitempty" yaml:",omitempty"`
	Site        string          `json:"git,omitempty" yaml:",omitempty"`
	Source      string          `json:"git,omitempty" yaml:",omitempty"`
	Issues      string          `json:"issues,omitempty" yaml:",omitempty"`
	Commands    *util.StringMap `json:"commands,omitempty" yaml:",omitempty"`
	Params      []string        `json:"params,omitempty" yaml:",omitempty"`
	Default     string          `json:"default,omitempty" yaml:",omitempty"`
	CompFunc   CompFunc `json:"-" yaml:"-"`
	Caller     *Command `json:"-" yaml:"-"`
	Method     Method   `json:"-" yaml:"-"`
	sync.Mutex `json:"-" yaml:"-"`
}
type Method func(args []string) error
func NewCommand(name string, a ...string) *Command {
	x := new(Command)
	if !valid.Name(name) && name[len(name)-1] != '_' {
		SyntaxErrorPanic(fmt.Sprintf(m_invalid_name, name))
	}
	x.Name = name
	x.Commands = util.NewStringMap()
	x.Default = "help"
	if len(a) > 0 {
		x.Add(a...)
	}
	x.UpdateUsage()
	return x
}
func (x *Command) Title() string {
	switch {
	case len(x.Summary) > 0 && len(x.Version) > 0:
		return x.Name + " (" + x.Version + ")" + " - " + x.Summary
	case len(x.Summary) > 0:
		return x.Name + " - " + x.Summary
	default:
		return x.Name
	}
}
func (x *Command) Legal() string {
	switch {
	case len(x.Copyright) > 0 && len(x.License) > 0 && len(x.Version) > 0:
		return x.Name + " " + x.Version + "\n" +
			x.Copyright + "\nLicense " + x.License
	case len(x.Copyright) > 0 && len(x.License) > 0:
		return x.Name + "\n" + x.Copyright + "\nLicense " + x.License
	case len(x.Copyright) > 0:
		return x.Name + "\n" + x.Copyright
	default:
		return ""
	}
}
func (x *Command) UpdateUsage() {
	names := x.Commands.Keys()
	if len(names) > 0 {
		x.Usage = "[" + strings.Join(names, "|") + "]"
	}
}
func (x Command) JSON() string { return util.ToJSON(x) }
func (x Command) YAML() string { return util.ToYAML(x) }
func (x Command) Print() { fmt.Println(util.ToYAML(x)) }
func (x Command) String() string { return util.ToJSON(x) }
func (x *Command) Add(sigs ...string) {
	defer x.Unlock()
	x.Lock()
	if x.Commands == nil {
		x.Commands = util.NewStringMap()
	}
	for _, sig := range sigs {
		aliases := strings.Split(sig, "|")
		name := aliases[len(aliases)-1]
		if !valid.Name(name) {
			panic(m_invalid_name)
		}
		x.Commands.Set(name, name)
		for _, alias := range aliases {
			if !valid.Name(alias) {
				panic(m_invalid_name)
			}
			x.Commands.Set(alias, name)
		}
	}
}
func (x *Command) Complete() {
	matches := []string{}
	switch {
	case x.CompFunc != nil:
		matches = x.CompFunc(x)
	case DefaultComplete != nil:
		matches = DefaultComplete(x)
	}
	for _, m := range matches {
		fmt.Println(m)
	}
}
func (x *Command) Unimplemented(a string) error { return Unimplemented(a) }
func (x *Command) UsageError() error { return UsageError(x) }