github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/fixtures/plugins/test_with_orgs.go (about) 1 /** 2 * 1. Setup the server so cf can call it under main. 3 e.g. `cf my-plugin` creates the callable server. now we can call the Run command 4 * 2. Implement Run that is the actual code of the plugin! 5 * 3. Return an error 6 **/ 7 8 package main 9 10 import ( 11 "fmt" 12 13 "github.com/liamawhite/cli-with-i18n/plugin" 14 ) 15 16 type TestWithOrgs struct { 17 } 18 19 func (c *TestWithOrgs) Run(cliConnection plugin.CliConnection, args []string) { 20 if args[0] == "orgs" { 21 theOrgsCmd() 22 } 23 } 24 25 func (c *TestWithOrgs) GetMetadata() plugin.PluginMetadata { 26 return plugin.PluginMetadata{ 27 Name: "TestWithOrgs", 28 Commands: []plugin.Command{ 29 { 30 Name: "orgs", 31 HelpText: "", 32 }, 33 }, 34 } 35 } 36 37 func theOrgsCmd() { 38 fmt.Println("You called orgs in test_with_orgs") 39 } 40 41 func main() { 42 plugin.Start(new(TestWithOrgs)) 43 }