plugcmd

package
v0.0.0-...-289cda9 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 5 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByAliaser

func ByAliaser(f plugfind.Finder) plugfind.Finder

DEPRECRATED: ByAliaser can be used to search plugins that implement Aliaser and who's alias matches the name

func ByCommander

func ByCommander(f plugfind.Finder) plugfind.FinderFn

DEPRECRATED: ByCommander can be used to search for plugins that implement Commander and who's plugin name matches the name

func ByNamer

func ByNamer(f plugfind.Finder) plugfind.Finder

DEPRECRATED: ByNamer can be used to search for plugins that implement Namer and who's CmdName matches the name

Types

type Aliaser

type Aliaser interface {
	plugins.Plugin
	CmdAliases() []string
}

Aliaser is a command that provides aliases for itself

type Commander

type Commander interface {
	plugins.Plugin
	Main(ctx context.Context, root string, args []string) error
}

Commander is a plugin that is meant to be the beginning of a CLI application

func Find

func Find(name string, plugs []plugins.Plugin) Commander

Find wraps the other cmd finders into a mega finder for cmds

func FindFromArgs

func FindFromArgs(args []string, plugs []plugins.Plugin) Commander

FindFromArgs uses the first arg that does not begin with `-` as the name argument for Find

type Namer

type Namer interface {
	plugins.Plugin
	CmdName() string
}

Namer is a command that provides a different name for the command than the name of the Plugin

type SubCommander

type SubCommander interface {
	SubCommands() []plugins.Plugin
}

SubCommander can be implemented to provide a list of plugins.Plugin that can be used as sub-commands of the current Plugin

Jump to

Keyboard shortcuts

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