cmd

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToCLICommand

func ToCLICommand(cmd Command) *cli.Command

ToCLICommand converts a Command to a cli.Command

Types

type BaseCommand

type BaseCommand struct {
	// contains filtered or unexported fields
}

BaseCommand provides a base implementation of the Command interface

func NewBaseCommand

func NewBaseCommand(name, usage string, flags []cli.Flag, action func(c *cli.Context) error) *BaseCommand

func (*BaseCommand) Action

func (b *BaseCommand) Action() func(c *cli.Context) error

func (*BaseCommand) Flags

func (b *BaseCommand) Flags() []cli.Flag

func (*BaseCommand) Name

func (b *BaseCommand) Name() string

func (*BaseCommand) Usage

func (b *BaseCommand) Usage() string

type Command

type Command interface {
	// Name returns the name of the command
	Name() string
	// Usage returns the usage description of the command
	Usage() string
	// Flags returns the flags for the command
	Flags() []cli.Flag
	// Action returns the action function for the command
	Action() func(c *cli.Context) error
}

Command is the interface that all commands must implement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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