plugin

package
v0.13.0-dev Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package plugin provides functions to create new CLI plugins.

Index

Constants

View Source
const CmdTemplate = `` /* 1078-byte string literal not displayed */

CmdTemplate is the template for plugin commands.

Variables

View Source
var UsageFunc = func(c *cobra.Command) error {
	t, err := template.New("usage").Funcs(cli.TemplateFuncs).Parse(CmdTemplate)
	if err != nil {
		return err
	}
	return t.Execute(os.Stdout, c)
}

UsageFunc is the usage func for a plugin.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	Cmd *cobra.Command
}

Plugin is a Tanzu CLI plugin.

func NewPlugin

func NewPlugin(descriptor *cliv1alpha1.PluginDescriptor) (*Plugin, error)

NewPlugin creates an instance of Plugin.

func NewPluginFromFile

func NewPluginFromFile(path string) (*Plugin, error)

NewPluginFromFile create a new instance of Plugin from a file descriptor.

func (*Plugin) AddCommands

func (p *Plugin) AddCommands(commands ...*cobra.Command)

AddCommands adds commands to the plugin.

func (*Plugin) Execute

func (p *Plugin) Execute() error

Execute executes the plugin.

Directories

Path Synopsis
Package lint provides linters to run against CLI plugins.
Package lint provides linters to run against CLI plugins.

Jump to

Keyboard shortcuts

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