Skip to content

Commit

Permalink
option --proto (git|http)
Browse files Browse the repository at this point in the history
  • Loading branch information
FCO committed Jan 4, 2010
1 parent c0db3f3 commit 196354a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/github
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ sub clone :Help(clone a github repository) {
}

my $repo = $c->stash->{repositories}->[$chosen];
my $clone_url = 'git://github.com/' . $repo->{username} . '/' . $repo->{name} . '.git';
my $clone_url;
if(not $c->options->{proto} or lc($c->options->{proto}) eq "git"){
$clone_url = 'git://github.com/' . $repo->{username} . '/' . $repo->{name} . '.git';
} elsif(lc($c->options->{proto}) eq "http"){
$clone_url = 'http://github.com/' . $repo->{username} . '/' . $repo->{name} . '.git';
} else {
my $proto = $c->options->{proto};
return "Proto $proto not recognized";
}

return _git('clone', $clone_url);
}
Expand All @@ -93,7 +101,7 @@ sub _git {
return 'Success!';
}
else {
return 'Error :(';
return "Error :($!)";
}
}

Expand Down

0 comments on commit 196354a

Please sign in to comment.