File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ GetOptions(
16
16
" l|list" => \$opts {list },
17
17
" r|repos" => \$opts {repos },
18
18
" i|issues" => \$opts {issues },
19
+ " o|org=s" => \$opts {org },
20
+ " a|all" => \$opts {all },
19
21
" v|verbose" => \$opts {verbose },
20
22
" h|help" => \$help ,
21
23
);
@@ -60,6 +62,8 @@ Options:
60
62
-p | --proxy Optional proxy (https://proxy.example.com:PORT)
61
63
-r | --repos Back up all of your repositories
62
64
-i | --issues Back up all of your issues
65
+ -o | --org Back up the repositories of this organisation
66
+ -a | --all Back up all repositories for the authenticated user
63
67
-h | --help Display this help page
64
68
65
69
EOF
@@ -69,7 +73,9 @@ my $gh = Github::Backup->new(
69
73
api_user => $opts {user },
70
74
token => $opts {token },
71
75
dir => $opts {dir },
72
- proxy => $opts {proxy }
76
+ proxy => $opts {proxy },
77
+ org => $opts {org },
78
+ all => $opts {all }
73
79
);
74
80
75
81
if ($opts {list }) {
Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ has proxy => (
42
42
has user => (
43
43
is => ' rw' ,
44
44
);
45
+ has org => (
46
+ is => ' rw' ,
47
+ );
48
+ has all => (
49
+ is => ' rw' ,
50
+ );
45
51
has limit => (
46
52
is => ' rw' ,
47
53
);
@@ -102,7 +108,12 @@ sub list {
102
108
my ($self ) = @_ ;
103
109
104
110
if (! $self -> {repo_list }) {
105
- my $repo_list = $self -> gh-> repos-> list(user => $self -> user);
111
+ my %params = $self -> all
112
+ ? ()
113
+ : $self -> org
114
+ ? (org => $self -> org)
115
+ : (user => $self -> user); # GH API: only public repos for this user
116
+ my $repo_list = $self -> gh-> repos-> list(%params );
106
117
while (my $repo = $repo_list -> next) {
107
118
push @{ $self -> {repo_list } }, $repo ;
108
119
}
You can’t perform that action at this time.
0 commit comments