Skip to content
Browse files

option --proto (git|http)

  • Loading branch information...
1 parent c0db3f3 commit 196354a88b416ff323e869d533c66c89fc71e513 @FCO FCO committed
Showing with 10 additions and 2 deletions.
  1. +10 −2 examples/github
View
12 examples/github
@@ -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);
}
@@ -93,7 +101,7 @@ sub _git {
return 'Success!';
}
else {
- return 'Error :(';
+ return "Error :($!)";
}
}

0 comments on commit 196354a

Please sign in to comment.
Something went wrong with that request. Please try again.