github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+incompatible/command/v2/curl_command.go (about)

     1  package v2
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/command"
     5  	"code.cloudfoundry.org/cli/command/flag"
     6  	"code.cloudfoundry.org/cli/command/translatableerror"
     7  )
     8  
     9  type CurlCommand struct {
    10  	RequiredArgs          flag.APIPath    `positional-args:"yes"`
    11  	CustomHeaders         []string        `short:"H" description:"Custom headers to include in the request, flag can be specified multiple times"`
    12  	HTTPMethod            string          `short:"X" description:"HTTP method (GET,POST,PUT,DELETE,etc)"`
    13  	HTTPData              flag.PathWithAt `short:"d" description:"HTTP data to include in the request body, or '@' followed by a file name to read the data from"`
    14  	IncludeReponseHeaders bool            `short:"i" description:"Include response headers in the output"`
    15  	OutputFile            flag.Path       `long:"output" description:"Write curl body to FILE instead of stdout"`
    16  	usage                 interface{}     `usage:"CF_NAME curl PATH [-iv] [-X METHOD] [-H HEADER] [-d DATA] [--output FILE]\n\n   By default 'CF_NAME curl' will perform a GET to the specified PATH. If data\n   is provided via -d, a POST will be performed instead, and the Content-Type\n   will be set to application/json. You may override headers with -H and the\n   request method with -X.\n\n   For API documentation, please visit http://apidocs.cloudfoundry.org.\n\nEXAMPLES:\n   CF_NAME curl \"/v2/apps\" -X GET -H \"Content-Type: application/x-www-form-urlencoded\" -d 'q=name:myapp'\n   CF_NAME curl \"/v2/apps\" -d @/path/to/file"`
    17  }
    18  
    19  func (CurlCommand) Setup(config command.Config, ui command.UI) error {
    20  	return nil
    21  }
    22  
    23  func (CurlCommand) Execute(args []string) error {
    24  	return translatableerror.UnrefactoredCommandError{}
    25  }