{"modulePath":"github.com/jenspinney/cli","version":"v6.42.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package main\n\n\\* \\* This is an example plugin where we use both arguments and flags. The plugin \\* will echo all arguments passed to it. The flag -uppercase will upcase the \\* arguments passed to the command. \\*\n\n## Types\n\n```go\ntype BasicPlugin struct{}\n```\nBasicPlugin is the struct implementing the interface defined by the core CLI. It can be found at  \"code.cloudfoundry.org/cli/plugin/plugin.go\"\n\n```go\nfunc (c *BasicPlugin) GetMetadata() plugin.PluginMetadata\n```\nGetMetadata must be implemented as part of the plugin interface defined by the core CLI.\n\nGetMetadata() returns a PluginMetadata struct. The first field, Name, determines the name of the plugin which should generally be without spaces. If there are spaces in the name a user will need to properly quote the name during uninstall otherwise the name will be treated as seperate arguments. The second value is a slice of Command structs. Our slice only contains one Command Struct, but could contain any number of them. The first field Name defines the command \\`cf basic-plugin-command\\` once installed into the CLI. The second field, HelpText, is used by the core CLI to display help information to the user in the core commands \\`cf help\\`, \\`cf\\`, or \\`cf -h\\`.\n\n```go\nfunc (c *BasicPlugin) Run(cliConnection plugin.CliConnection, args []string)\n```\nRun must be implemented by any plugin because it is part of the plugin interface defined by the core CLI.\n\nRun(....) is the entry point when the core CLI is invoking a command defined by a plugin. The first parameter, plugin.CliConnection, is a struct that can be used to invoke cli commands. The second paramter, args, is a slice of strings. args\\[0] will be the name of the command, and will be followed by any additional arguments a cli user typed in.\n\nAny error handling should be handled with the plugin itself (this means printing user facing errors). The CLI will exit 0 if the plugin exits 0 and will exit 1 should the plugin exits nonzero.\n\n```go\ntype Interactive struct{}\n```\n\n```go\nfunc (c *Interactive) GetMetadata() plugin.PluginMetadata\n```\n\n```go\nfunc (c *Interactive) Run(cliConnection plugin.CliConnection, args []string)\n```\n\n```go\ntype MultiCmd struct{}\n```\n\n```go\nfunc (c *MultiCmd) Command1()\n```\n\n```go\nfunc (c *MultiCmd) Command2()\n```\n\n```go\nfunc (c *MultiCmd) Command3()\n```\n\n```go\nfunc (c *MultiCmd) GetMetadata() plugin.PluginMetadata\n```\n\n```go\nfunc (c *MultiCmd) Run(cliConnection plugin.CliConnection, args []string)\n```\n\n```go\ntype PluginDemonstratingParams struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (pluginDemo *PluginDemonstratingParams) GetMetadata() plugin.PluginMetadata\n```\n\n```go\nfunc (pluginDemo *PluginDemonstratingParams) Run(cliConnection plugin.CliConnection, args []string)\n```\n\n","path":"github.com/jenspinney/cli/plugin/plugin_examples","name":"main","synopsis":"* * This is an example plugin where we use both arguments and flags.","isRedistributable":true}
