Skip to content

Commit

Permalink
language/topic limits
Browse files Browse the repository at this point in the history
  • Loading branch information
bbkane committed Jan 7, 2022
1 parent 7df930b commit 88d506f
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ type starredRepositoryEdge struct {
Name string
}
}
} `graphql:"languages(first: 10)"`
} `graphql:"languages(first: $maxLanguages)"`
NameWithOwner string
Object struct {
Blob struct {
Expand All @@ -330,7 +330,7 @@ type starredRepositoryEdge struct {
Name string
}
}
} `graphql:"repositoryTopics(first: 10)"`
} `graphql:"repositoryTopics(first: $maxRepositoryTopics)"`
StargazerCount int
UpdatedAt formattedDate
Url string
Expand All @@ -345,6 +345,9 @@ func stats(pf flag.PassedFlags) error {
format := pf["--format"].(string)
timeout := pf["--timeout"].(time.Duration)
includeReadmes := pf["--include-readmes"].(bool)
zincIndexName := pf["--zinc-index-name"].(string)
maxLanguages := pf["--max-languages"].(int)
maxRepoTopics := pf["--max-repo-topics"].(int)

dateFormatStr, dateFormatStrExists := pf["--date-format"].(string)

Expand All @@ -358,8 +361,6 @@ func stats(pf flag.PassedFlags) error {
}
}

zincIndexName := pf["--zinc-index-name"].(string)

fp := os.Stdout
if outputExists {
newFP, err := os.Create(output)
Expand Down Expand Up @@ -416,6 +417,8 @@ func stats(pf flag.PassedFlags) error {
"starredRepositoriesCursor": (*githubv4.String)(nil),
"starredRepositoryPageSize": githubv4.NewInt(githubv4.Int(pageSize)),
"includeREADME": githubv4.Boolean(includeReadmes),
"maxLanguages": githubv4.Int(maxLanguages),
"maxRepositoryTopics": githubv4.Int(maxRepoTopics),
}

for i := 0; i < maxPages; i++ {
Expand Down Expand Up @@ -573,6 +576,18 @@ func main() {
value.Bool,
flag.Default("false"),
),
command.Flag(
"--max-languages",
"Max number of languages to query on a repo",
value.Int,
flag.Default("20"),
),
command.Flag(
"--max-repo-topics",
"Max number of topics to query on a repo",
value.Int,
flag.Default("20"),
),
),
section.Flag(
"--max-pages",
Expand Down

0 comments on commit 88d506f

Please sign in to comment.