github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/command/v2/create_buildpack_command.go (about)

     1  package v2
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/liamawhite/cli-with-i18n/cf/cmd"
     7  	"github.com/liamawhite/cli-with-i18n/command"
     8  	"github.com/liamawhite/cli-with-i18n/command/flag"
     9  	"github.com/liamawhite/cli-with-i18n/command/translatableerror"
    10  )
    11  
    12  type CreateBuildpackCommand struct {
    13  	RequiredArgs    flag.CreateBuildpackArgs `positional-args:"yes"`
    14  	Disable         bool                     `long:"disable" description:"Disable the buildpack from being used for staging"`
    15  	Enable          bool                     `long:"enable" description:"Enable the buildpack to be used for staging"`
    16  	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."`
    17  	relatedCommands interface{}              `related_commands:"buildpacks, push"`
    18  }
    19  
    20  func (CreateBuildpackCommand) Setup(config command.Config, ui command.UI) error {
    21  	return nil
    22  }
    23  
    24  func (c CreateBuildpackCommand) Execute(args []string) error {
    25  	_, err := flag.ParseStringToInt(c.RequiredArgs.Position)
    26  	if err != nil {
    27  		return translatableerror.ParseArgumentError{
    28  			ArgumentName: "POSITION",
    29  			ExpectedType: "integer",
    30  		}
    31  	}
    32  
    33  	cmd.Main(os.Getenv("CF_TRACE"), os.Args)
    34  	return nil
    35  }