Skip to content

Commit

Permalink
add verbose flag
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Sep 12, 2010
1 parent b33ce9e commit ff23a58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
1 change: 0 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ lib/App/gh/Utils.pm
Makefile.PL
MANIFEST
META.yml
read-auth.pl
README.mkd
scripts/gh
t/00-load.t
Expand Down
17 changes: 7 additions & 10 deletions lib/App/gh/Command/Cloneall.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ use App::gh::Utils;
use LWP::Simple qw(get);
use JSON;

sub options {
(
sub options { (
"verbose" => "verbose",
"into=s" => "into"
)
}
) }

sub run {
my $self = shift;
Expand All @@ -27,15 +26,13 @@ sub run {

die 'need id' unless $acc;

_info "Getting repository list from github: $acc";
_info "Getting repository list from github: $acc" if $self->{verbose};
my $json = get 'http://github.com/api/v2/json/repos/show/' . $acc;
my $data = decode_json( $json );

_info "Will clone repositories below:";
for my $repo ( @{ $data->{repositories} } ) {
print " " . $repo->{name} . "\n";
}

print join " " , map { $_->{name} } @{ $data->{repositories} };
print "\n";

for my $repo ( @{ $data->{repositories} } ) {
my $repo_name = $repo->{name};
Expand All @@ -49,7 +46,7 @@ sub run {
elsif( $attr eq 'ssh' ) {
$uri = sprintf "git\@github.com:%s/%s.git" , $acc , $repo_name;
}
print $uri . "\n";
print $uri . "\n" if $self->{verbose};

if( -e $local_repo_name ) {
print "Updating " . $local_repo_name . " ...\n";
Expand Down

0 comments on commit ff23a58

Please sign in to comment.