Last active
December 20, 2015 14:19
-
-
Save tkuchiki/6145491 to your computer and use it in GitHub Desktop.
git:// を proxy 経由で、git clone する際に使うスクリプト。環境変数 http_proxy を使用。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$ENV{'http_proxy'} =~ m|^https?://(.+?):?(\d+)?(/.*)?$|; | |
unless ($1 || $2) { | |
print "http_proxy is invalid\n"; | |
exit 1; | |
} | |
my $domain = $1; | |
my $port = $2 || 80; | |
$corkscrew = `which corkscrew 2> /dev/null`; | |
if ($?) { | |
print "corkscrew is not found.\n"; | |
exit 1; | |
} | |
chomp($corkscrew); | |
system("${corkscrew} ${domain} ${port} ${ARGV[0]} ${ARGV[1]}"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment