github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/command/v2/create_buildpack_command.go (about)

     1  package v2
     2  
     3  import (
     4  	"os"
     5  
     6  	"code.cloudfoundry.org/cli/cf/cmd"
     7  	"code.cloudfoundry.org/cli/command"
     8  	"code.cloudfoundry.org/cli/command/flag"
     9  )
    10  
    11  type CreateBuildpackCommand struct {
    12  	RequiredArgs    flag.CreateBuildpackArgs `positional-args:"yes"`
    13  	Disable         bool                     `long:"disable" description:"Disable the buildpack from being used for staging"`
    14  	Enable          bool                     `long:"enable" description:"Enable the buildpack to be used for staging"`
    15  	usage           interface{}              `usage:"CF_NAME create-buildpack BUILDPACK PATH POSITION [--enable|--disable]\n\nTIP:\n   Path should be a zip file, a url to a zip file, or a local directory. Position is a positive integer, sets priority, and is sorted from lowest to highest."`
    16  	relatedCommands interface{}              `related_commands:"buildpacks, push"`
    17  }
    18  
    19  func (_ CreateBuildpackCommand) Setup(config command.Config, ui command.UI) error {
    20  	return nil
    21  }
    22  
    23  func (c CreateBuildpackCommand) Execute(args []string) error {
    24  	_, err := flag.ParseStringToInt(c.RequiredArgs.Position)
    25  	if err != nil {
    26  		return command.ParseArgumentError{
    27  			ArgumentName: "POSITION",
    28  			ExpectedType: "integer",
    29  		}
    30  	}
    31  
    32  	cmd.Main(os.Getenv("CF_TRACE"), os.Args)
    33  	return nil
    34  }