File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,4 +9,4 @@ This repository holds query samples for the GitHub GraphQL API. It's an easy way
991 . Pick the name of one of the included queries in the ` /queries ` directory, such as ` viewer.graphql ` .
10101 . Run ` ./index.js <query_file> <token> `
1111
12- To change variables values, just modify the variables in the ` .graphql ` file.
12+ To change variable values, modify the variables in the ` .graphql ` file.
Original file line number Diff line number Diff line change @@ -14,18 +14,29 @@ program
1414 console . log ( "Running query: " + file ) ;
1515 runQuery ( file , token ) ;
1616 } )
17- . description ( 'Execute specified GraphQL query' ) ;
17+ . description ( 'Execute specified GraphQL query. ' ) ;
1818
19- program . parse ( process . argv ) ;
19+ program . on ( '--help' , function ( ) {
20+ console . log ( '' ) ;
21+ console . log ( ' Arguments:' ) ;
22+ console . log ( '' ) ;
23+ console . log ( ' file : Path to file containing GraphQL' ) ;
24+ console . log ( ' token: Properly scoped GitHub PAT' ) ;
25+ console . log ( '' ) ;
26+ } ) ;
2027
21- if ( ! process . argv . slice ( 2 ) . length )
28+ //Commander doesn't seem to do anything when both required arguments are missing
29+ //So we'll check the old-fashioned way
30+ if ( process . argv . length != 4 )
2231{
23- console . log ( "Missing query file and/or token argument" ) ;
24- process . exitCode = 1 ;
32+ console . log ( 'Usage: ./index.js ' + program . usage ( ) ) ;
33+ process . exitCode = 1
2534}
2635
36+ program . parse ( process . argv ) ;
37+
2738function runQuery ( file , token ) {
28-
39+
2940 try {
3041 var queryText = fs . readFileSync ( file , "utf8" ) ;
3142 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ query getOrg($orgLogin:String!) {
22 organization (login : $orgLogin ) {
33 login
44 name
5- members (first : 1 ) {
5+ members (first : 100 ) {
66 edges {
77 node {
88 login
You can’t perform that action at this time.
0 commit comments