~emersion/public-inbox

gqlclient: cmd/gqlintrospect: add usage v1 APPLIED

Adnan Maolood: 1
 cmd/gqlintrospect: add usage

 1 files changed, 15 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/33815/mbox | git am -3
Learn more about email & git

[PATCH gqlclient] cmd/gqlintrospect: add usage Export this patch

---
 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