github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/fixtures/plugins/input.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 Input struct {
    19  }
    20  
    21  func (c *Input) Run(cliConnection plugin.CliConnection, args []string) {
    22  	if args[0] == "input" {
    23  		var Echo string
    24  		fmt.Scanf("%s", &Echo)
    25  
    26  		fmt.Println("THE WORD IS: ", Echo)
    27  	}
    28  }
    29  
    30  func (c *Input) GetMetadata() plugin.PluginMetadata {
    31  	return plugin.PluginMetadata{
    32  		Name: "Input",
    33  		Commands: []plugin.Command{
    34  			{
    35  				Name:     "input",
    36  				HelpText: "help text for input",
    37  			},
    38  		},
    39  	}
    40  }
    41  
    42  func main() {
    43  	plugin.Start(new(Input))
    44  }