You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #22: Handle pagination for organisation/user 📄
Current page can be set via a new '--page' flag (default: 1):
$ gh collab-scanner --org softwarevidal --page 2
$ gh collab-scanner --user nicokosi --page 2
Page size is hard-coded to 100.
PS:
- I could not retrieve pagination info (page x on y) because
of this limitation 😭:
cli/go-gh#23
- I tried to guess current page via Exec for
"gh repo list $user --json id --limit 1000" but response time
was very slow. 🐌
See https://github.com/cli/go-gh/blob/trunk/example_gh_test.go#L16
Copy file name to clipboardExpand all lines: main.go
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ import (
4
4
"flag"
5
5
"fmt"
6
6
"os"
7
+
"strconv"
7
8
"strings"
8
9
9
10
"github.com/cli/go-gh"
@@ -13,16 +14,18 @@ type config struct {
13
14
repostring
14
15
orgstring
15
16
userstring
17
+
pageint
16
18
verbosebool
17
19
}
18
20
19
21
funcparseFlags() config {
20
22
repo:=flag.String("repo", "", "a optional GitHub repository (i.e. 'python/peps') ; use repo for current folder if omitted and no 'org' nor 'user' flag")
21
23
org:=flag.String("org", "", "a optional GitHub organization (i.e. 'python') to scan the repositories from (100 max) ; use repo for current folder if omitted and no 'repo' nor 'user' flag")
22
24
user:=flag.String("user", "", "a optional GitHub user (i.e. 'torvalds') to scan the repositories from (100 max); use repo for current folder if omitted and no 'repo' nor 'org' flag")
25
+
page:=flag.Int("page", 1, "Page number for 'repo' and 'user' flags, 100 repositories per pages")
23
26
verbose:=flag.Bool("verbose", false, "mode that outputs several lines (otherwise, outputs a one-liner) ; default: false")
0 commit comments