plugins

package
v0.7.11 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Plugin

	// ParentName allows to identify subcommands and its parents.
	ParentName() string

	// Run the command with the passed context, root and args.
	Run(context.Context, string, []string) error
}

Command interface for commands that the CLI provides. a command is one of the top cli elements (build, fix, generate ...)

type FlagParser

type FlagParser interface {
	Plugin

	ParseFlags([]string)
	Flags() *pflag.FlagSet
}

FlagParser is a plugin that will use the params to parse flags that may affect the way it work.

type HelpTexter

type HelpTexter interface {
	// Help returns a string describing what the command/subcommand does.
	HelpText() string
}

HelpTexter interface allows plugins to provide text to the help command or subcommand.

type Plugin

type Plugin interface {
	Name() string
}

Plugin interface is the base for the different plugins that can be attached to the plugin system. It is based on the `Name() string` method that will be useful for identification of the plugin.

Other plugins (PluginReceivers) could specify other interfaces to identify plugins specific to what they do.

type PluginReceiver

type PluginReceiver interface {
	Plugin

	Receive([]Plugin)
}

PluginReceiver is an interface for those plugins that need to receive the list of plugins.

type Subcommander

type Subcommander interface {
	Command
	PluginReceiver

	Subcommands() []Command
}

Subcommander allows a plugin to say which are its subcommands.

Jump to

Keyboard shortcuts

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