Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Gh info #55

Merged
merged 2 commits into from Sep 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/App/gh/Command/All.pm
Expand Up @@ -210,11 +210,11 @@ __END__

=head1 NAME

App::gh::Command::All - clone/update all repositories from one
App::gh::Command::All - clone/update all repositories from a GitHub user

=head1 DESCRIPTION

If you need a mirror of repos from one, you will need this command.
If you need a mirror of all the repositories of a GitHub user, you will need this command.

If repos exists, clone command will pull changes for these repos from remotes.

Expand All @@ -234,7 +234,7 @@ command again:

=head1 OPTIONS

Genernal Options:
General Options:

--prompt
prompt for each cloning repo.
Expand Down
27 changes: 17 additions & 10 deletions lib/App/gh/Command/Info.pm
Expand Up @@ -8,11 +8,16 @@ use App::gh::Utils;

sub parse_uri {
my ($uri) = @_;
if ( $uri =~ m{(git|https?)://github.com/(.*?)/(.*?).git} ) {
return ($2,$3,$1);
} elsif ( $uri =~ m{git\@github.com:(.*?)/(.*?).git} ) {
return ($1,$2,'git');
}

return ($2,$3,$1)
if $uri =~ m{(git|https?)://github.com/(.*?)/(.*?).git};

return ($1,$2,'git')
if $uri =~ m{git\@github.com:(.*?)/(.*?).git};

return ( $1, $2 )
if $uri =~ m#([^/:]+)/([^/]+)(?:\.git)?$#;

return undef;
}

Expand All @@ -26,11 +31,13 @@ sub get_remote {

sub run {
my $self = shift;
# my $gh_id = App::gh->config->github_id();
my $remote = $self->get_remote();
die "Remote not found\n." unless $remote;
my ( $user, $repo, $uri_type ) = parse_uri( $remote->{url} );
my $ret = App::gh->api->repo_info( $user, $repo );

my $remote = $self->get_remote
or die "Remote not found\n.";

my ( $user, $repo ) = parse_uri( $remote->{url} );

my $ret = App::gh->github->repos->get( $user, $repo );
App::gh::Utils->print_repo_info( $ret );
}

Expand Down