~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH gqlclient] cmd/gqlintrospect: add usage

Details
Message ID
<20220712170320.19958-1-me@adnano.co>
DKIM signature
pass
Download raw message
Patch: +15 -1
---
 cmd/gqlintrospect/main.go | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/cmd/gqlintrospect/main.go b/cmd/gqlintrospect/main.go
index 48e2be9..ab8a818 100644
--- a/cmd/gqlintrospect/main.go
+++ b/cmd/gqlintrospect/main.go
@@ -6,12 +6,22 @@ import (
	"fmt"
	"log"
	"net/http"
	"os"
	"strings"
	"time"

	"git.sr.ht/~emersion/gqlclient"
)

const usage = `usage: gqlintrospect <endpoint>

Fetch the GraphQL schema of the specifed GraphQL endpoint.

Options:

  -H <key:value>  Set an HTTP header. Can be specified multiple times.
`

// The query used to determine type information
const query = `
query IntrospectionQuery {
@@ -309,11 +319,15 @@ func main() {

	var header []string
	flag.Var((*stringSliceFlag)(&header), "H", "set HTTP header")
	flag.Usage = func() {
		fmt.Print(usage)
	}
	flag.Parse()

	endpoint := flag.Arg(0)
	if endpoint == "" {
		log.Fatalf("missing endpoint")
		flag.Usage()
		os.Exit(1)
	}

	op := gqlclient.NewOperation(query)
-- 
2.37.0
Reply to thread Export thread (mbox)