cmd

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmnd

func Cmnd(name string, arg ...string) *exec.Cmd

func DefaultSubCommandRun

func DefaultSubCommandRun() func(c *cobra.Command, args []string)

DefaultSubCommandRun prints a command's help string to the specified output if no arguments (sub-commands) are provided, or a usage error otherwise.

func Execute

func Execute(executablePath string, cmdArgs, environment []string) error

func RequireNoArguments

func RequireNoArguments(c *cobra.Command, args []string)

RequireNoArguments exits with a usage error if extra arguments are provided.

func Run

func Run(executablePath string, cmdArgs, environment []string) error

func UsageErrorf

func UsageErrorf(cmd *cobra.Command, format string, args ...interface{}) error

Types

type Command

type Command struct {
	*cobra.Command
	Config *config.Config
}

func NewCmdPlugin

func NewCmdPlugin(name, description string) *Command

func (*Command) AddCommands

func (c *Command) AddCommands(commands ...*Command)

func (*Command) AddGroups

func (c *Command) AddGroups(title string, cmds ...*Command)

func (*Command) AddPlugins

func (c *Command) AddPlugins()

func (*Command) HandlePluginCommand

func (c *Command) HandlePluginCommand(cmdArgs []string) error

HandlePluginCommand receives a pluginHandler and command-line arguments and attempts to find a plugin executable on the PATH that satisfies the given arguments.

Jump to

Keyboard shortcuts

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