diff --git a/src/client.go b/src/client.go index c2b581c..01d9e8b 100644 --- a/src/client.go +++ b/src/client.go @@ -13,10 +13,13 @@ ) type ClientCommand struct { - URL string `short:"u" long:"url" description:"The URL to send the request to." required:"true"` Headers []string `short:"H" long:"header" description:"A header to add to request in the form name:value. Use multiple times for multiple headers."` Method string `short:"m" long:"method" choice:"GET" choice:"POST" choice:"PUT" choice:"DELETE" choice:"PATCH" choice:"HEAD" choice:"OPTIONS" description:"HTTP method for request." default:"GET"` Body string `short:"b" long:"body" description:"Request body to send."` + URL string `positional-arg-name:"URL" description:"The URL to send the request to." required:"true"` + Args struct { + URL string + } `positional-args:"yes" required:"yes"` } func (opts *ClientCommand) Execute(args []string) error { @@ -28,7 +31,7 @@ client := http.Client{} - request, _ := http.NewRequest(opts.Method, opts.URL, strings.NewReader(opts.Body)) + request, _ := http.NewRequest(opts.Method, opts.Args.URL, strings.NewReader(opts.Body)) // add extra headers if specified if len(opts.Headers) > 0 {