File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Expand file tree Collapse file tree 3 files changed +19
-8
lines changed 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
9
9
1 . Pick the name of one of the included queries in the ` /queries ` directory, such as ` viewer.graphql ` .
10
10
1 . Run ` ./index.js <query_file> <token> `
11
11
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
14
14
console . log ( "Running query: " + file ) ;
15
15
runQuery ( file , token ) ;
16
16
} )
17
- . description ( 'Execute specified GraphQL query' ) ;
17
+ . description ( 'Execute specified GraphQL query. ' ) ;
18
18
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
+ } ) ;
20
27
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 )
22
31
{
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
25
34
}
26
35
36
+ program . parse ( process . argv ) ;
37
+
27
38
function runQuery ( file , token ) {
28
-
39
+
29
40
try {
30
41
var queryText = fs . readFileSync ( file , "utf8" ) ;
31
42
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ query getOrg($orgLogin:String!) {
2
2
organization (login : $orgLogin ) {
3
3
login
4
4
name
5
- members (first : 1 ) {
5
+ members (first : 100 ) {
6
6
edges {
7
7
node {
8
8
login
You can’t perform that action at this time.
0 commit comments