github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/fixtures/plugins/test_with_push.go (about)

     1  // +build !V7
     2  
     3  /**
     4  	* 1. Setup the server so cf can call it under main.
     5  				e.g. `cf my-plugin` creates the callable server. now we can call the Run command
     6  	* 2. Implement Run that is the actual code of the plugin!
     7  	* 3. Return an error
     8  **/
     9  
    10  package main
    11  
    12  import (
    13  	"fmt"
    14  
    15  	"code.cloudfoundry.org/cli/plugin"
    16  )
    17  
    18  type TestWithPush struct {
    19  }
    20  
    21  func (c *TestWithPush) Run(cliConnection plugin.CliConnection, args []string) {
    22  	if args[0] == "push" {
    23  		thePushCmd()
    24  	}
    25  }
    26  
    27  func (c *TestWithPush) GetMetadata() plugin.PluginMetadata {
    28  	return plugin.PluginMetadata{
    29  		Name: "TestWithPush",
    30  		Commands: []plugin.Command{
    31  			{
    32  				Name:     "push",
    33  				HelpText: "push text for test_with_push",
    34  			},
    35  		},
    36  	}
    37  }
    38  
    39  func thePushCmd() {
    40  	fmt.Println("You called push in test_with_push")
    41  }
    42  
    43  func main() {
    44  	plugin.Start(new(TestWithPush))
    45  }