app

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandTag = commandTag{}
View Source
var ErrUsage = errors.New("usage")
View Source
var ItemColor = color.New(color.FgGreen)

Functions

func Args

func Args(ctx context.Context) []string

func Init

func Init(commands []Command, logger pry.Logger, provider hilton.Provider) (*app, error)

func NewCommand

func NewCommand(name, description string) *baseCommand

func NewContextWithCommand

func NewContextWithCommand(name string, args []string, provider hilton.Provider, logger pry.Logger) context.Context

args is shaped [<command-name>, <rest>...] — same form (*getopt.Set).Getopt expects.

func PrintList

func PrintList(w io.Writer, header string, items map[string]string)

func WithArgs

func WithArgs(ctx context.Context, args []string) context.Context

Types

type App

type App interface {
	RunUntilStop()
	Run() error
	Stop() error
}

type BaseCommand

type BaseCommand interface {
	Name() string
	Description() string
	Usage(ctx context.Context) error
}

type Command

type Command interface {
	BaseCommand
	Run(ctx context.Context) error
}

type Commands

type Commands interface {
	Get(name string) Command
}

type CommandsAware

type CommandsAware interface {
	SetCommands(Commands)
}

type Configure

type Configure interface{}

type Daemon

type Daemon interface {
	Command
	Daemon()
}

type HasCloser

type HasCloser interface {
	SetCloser(func() error)
	Closer() func() error
}

Jump to

Keyboard shortcuts

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