@@ -3,6 +3,7 @@ package cmd
33import (
44 "github.com/rsteube/carapace"
55 "github.com/rsteube/carapace-bin/completers/gh_completer/cmd/action"
6+ "github.com/rsteube/carapace-bin/pkg/actions/net/http"
67 "github.com/spf13/cobra"
78)
89
@@ -15,21 +16,22 @@ var apiCmd = &cobra.Command{
1516func init () {
1617 carapace .Gen (apiCmd ).Standalone ()
1718 apiCmd .Flags ().Duration ("cache" , 0 , "Cache the response, e.g. \" 3600s\" , \" 60m\" , \" 1h\" " )
18- apiCmd .Flags ().StringArrayP ("field" , "F" , nil , "Add a typed parameter in `key=value` format" )
19- apiCmd .Flags ().StringArrayP ("header" , "H" , nil , "Add a HTTP request header in `key:value` format" )
19+ apiCmd .Flags ().StringArrayP ("field" , "F" , [] string {} , "Add a typed parameter in `key=value` format" )
20+ apiCmd .Flags ().StringArrayP ("header" , "H" , [] string {} , "Add a HTTP request header in `key:value` format" )
2021 apiCmd .Flags ().String ("hostname" , "" , "The GitHub hostname for the request (default \" github.com\" )" )
2122 apiCmd .Flags ().BoolP ("include" , "i" , false , "Include HTTP response headers in the output" )
22- apiCmd .Flags ().String ("input" , "" , "The `file` to use as body for the HTTP request" )
23+ apiCmd .Flags ().String ("input" , "" , "The `file` to use as body for the HTTP request (use \" - \" to read from standard input) " )
2324 apiCmd .Flags ().StringP ("jq" , "q" , "" , "Query to select values from the response using jq syntax" )
2425 apiCmd .Flags ().StringP ("method" , "X" , "GET" , "The HTTP method for the request" )
2526 apiCmd .Flags ().Bool ("paginate" , false , "Make additional HTTP requests to fetch all pages of results" )
26- apiCmd .Flags ().StringSliceP ("preview" , "p" , nil , "Opt into GitHub API previews" )
27- apiCmd .Flags ().StringArrayP ("raw-field" , "f" , nil , "Add a string parameter in `key=value` format" )
27+ apiCmd .Flags ().StringSliceP ("preview" , "p" , [] string {} , "Opt into GitHub API previews" )
28+ apiCmd .Flags ().StringArrayP ("raw-field" , "f" , [] string {} , "Add a string parameter in `key=value` format" )
2829 apiCmd .Flags ().Bool ("silent" , false , "Do not print the response body" )
2930 apiCmd .Flags ().StringP ("template" , "t" , "" , "Format the response using a Go template" )
3031 rootCmd .AddCommand (apiCmd )
3132
3233 carapace .Gen (apiCmd ).FlagCompletion (carapace.ActionMap {
34+ "header" : http .ActionHttpRequestHeaders (),
3335 "hostname" : action .ActionConfigHosts (),
3436 "input" : carapace .ActionFiles (),
3537 "method" : action .ActionHttpMethods (),
0 commit comments