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