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.
View Source
const DefaultDocsDir = "docs/cli/commands"
DefaultDocsDir is the base docs directory
View Source
const ErrorDocsOutputFolderNotExists = "" /* 137-byte string literal not displayed */
Variables ¶
View Source
var TemplateFuncs = template.FuncMap{ "rpad": component.Rpad, "bold": component.Bold, "underline": component.Underline, "trimTrailingWhitespaces": component.TrimRightSpace, "beginsWith": component.BeginsWith, }
TemplateFuncs are the template usage funcs.
View Source
var UsageFunc = func(c *cobra.Command) error { t, err := template.New("usage").Funcs(TemplateFuncs).Parse(CmdTemplate) if err != nil { return err } return t.Execute(os.Stdout, c) }
UsageFunc is the usage func for a plugin.
Functions ¶
func ApplyDefaultConfig ¶
func ApplyDefaultConfig(p *cliapi.PluginDescriptor)
ApplyDefaultConfig applies default configurations to plugin descriptor.
func ValidatePlugin ¶
func ValidatePlugin(p *cliapi.PluginDescriptor) (err error)
ValidatePlugin validates the plugin descriptor.
Types ¶
type Plugin ¶
Plugin is a Tanzu CLI plugin.
func NewPlugin ¶
func NewPlugin(descriptor *cliapi.PluginDescriptor) (*Plugin, error)
NewPlugin creates an instance of Plugin.
func NewPluginFromFile ¶
NewPluginFromFile create a new instance of Plugin from a file descriptor.
func (*Plugin) AddCommands ¶
AddCommands adds commands to the plugin.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.