charm

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 7 Imported by: 27

Documentation

Overview

Package charm is minimilast CLI framework inspired by cobra and urfave/cli.

Index

Constants

This section is empty.

Variables

View Source
var (
	NeedHelp = errors.New("help")
	ErrNoRun = errors.New("no run method")
)
View Source
var (
	HelpFlag     = "h"
	HelpLongFlag = "help"
	HiddenFlag   = "hidden"
)

Functions

func FormatParagraph

func FormatParagraph(body, tab string, lineWidth int) string

Types

type Command

type Command interface {
	Run([]string) error
}

type Constructor

type Constructor func(Command, *flag.FlagSet) (Command, error)

type Spec

type Spec struct {
	Name  string
	Usage string
	Short string
	Long  string
	New   Constructor
	// Hidden hides this command from help.
	Hidden bool
	// Hidden flags (comma-separated) marks these flags as hidden.
	HiddenFlags string
	// Redacted flags (comma-separated) marks these flags as redacted,
	// where a flag is shown (if not hidden) but its default value is hidden,
	// e.g., as is useful for a password flag.
	RedactedFlags string
	// contains filtered or unexported fields
}

func (*Spec) Add

func (c *Spec) Add(child *Spec)

func (*Spec) Exec

func (s *Spec) Exec(parent Command, args []string) error

func (*Spec) ExecRoot

func (s *Spec) ExecRoot(args []string) error

Jump to

Keyboard shortcuts

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