sakana

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InternalError added in v0.1.6

func InternalError(w io.Writer)

func SetLogFile added in v0.7.0

func SetLogFile(w io.Writer)

func UsageError added in v0.1.7

func UsageError(w io.Writer, message string)

Types

type Command

type Command struct {
	FlagSet *flag.FlagSet
	// contains filtered or unexported fields
}

Command routes handler by command (`FlagSet.Args()[0]`)

func NewCommand

func NewCommand(name string) *Command

func (*Command) Command

func (c *Command) Command(name string, description string, h Handler)

Command registers or updates a subcommand

func (*Command) Example

func (c *Command) Example(usage string, description string)

Example registers an example

func (*Command) OptionUsage

func (c *Command) OptionUsage(names []string, required bool, description string)

OptionUsage registers a option to display in Usage

func (*Command) ServeArgs

func (c *Command) ServeArgs(w io.Writer, args []string)

func (*Command) Summary added in v0.7.0

func (c *Command) Summary(usage string, description string)

func (*Command) Usage

func (c *Command) Usage() string

Usage generates the usage string

func (*Command) Welcome

func (c *Command) Welcome(msg string)

Welcome registers a welcome message at the beginning of Usage

func (*Command) Work

func (c *Command) Work(work Handler)

type Handler

type Handler interface {
	ServeArgs(w io.Writer, args []string)
}

type HandlerFunc

type HandlerFunc func(w io.Writer, args []string)

func (HandlerFunc) ServeArgs

func (h HandlerFunc) ServeArgs(w io.Writer, args []string)

Jump to

Keyboard shortcuts

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