Skip to content

Commit d75c34e

Browse files
committed
We now output verbose information on issues/repos as we iterate them
1 parent 9533297 commit d75c34e

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Revision history for Github-Backup
77
- Added --list, prints to STDOUT the full list of available repository
88
objects for the given user
99
- Changed github_backup to github-backup
10+
- We now output information on what repo/issue we're working on
11+
- Added Hook::Output::Tiny to hide STDERR messages when cloning
1012

1113
1.02 2018-02-12
1214
- fix missing newline backslash in SYNOPSIS

Makefile.PL

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ WriteMakefile(
3333
'Test::More' => 0,
3434
},
3535
PREREQ_PM => {
36-
'JSON' => 0,
37-
'LWP::UserAgent' => 6.19,
38-
'Moo' => 2.003000,
39-
'Pithub' => 0.01033,
36+
'Hook::Output::Tiny' => 0,
37+
'JSON' => 0,
38+
'LWP::UserAgent' => 6.19,
39+
'Moo' => 2.003000,
40+
'Pithub' => 0.01033,
4041
},
4142
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
4243
clean => { FILES => 'Github-Backup-*' },

lib/Github/Backup.pm

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use warnings;
66
use Carp qw(croak);
77
use Data::Dumper;
88
use Git::Repository;
9+
use Hook::Output::Tiny;
910
use File::Copy;
1011
use File::Path;
1112
use JSON;
@@ -113,10 +114,12 @@ sub repos {
113114
my $repos = $self->list;
114115

115116
for my $repo (@$repos){
116-
my $stg = $self->stg . "/$repo->{name}";
117+
$self->_trap->hook('stderr');
117118

118119
print "Cloning $repo->{name}\n";
119120

121+
my $stg = $self->stg . "/$repo->{name}";
122+
120123
if (! $self->forks){
121124
if (! exists $repo->{parent}){
122125
Git::Repository->run(
@@ -131,6 +134,7 @@ sub repos {
131134
{ quiet => 0 }
132135
);
133136
}
137+
$self->_trap->unhook('stderr');
134138
}
135139
}
136140
sub issues {
@@ -164,6 +168,14 @@ sub issues {
164168
}
165169
}
166170
}
171+
sub _trap {
172+
my ($self) = @_;
173+
if (! $self->{trap}) {
174+
$self->{trap} = Hook::Output::Tiny->new;
175+
}
176+
177+
return $self->{trap};
178+
}
167179
sub DESTROY {
168180
my $self = shift;
169181

0 commit comments

Comments
 (0)