#!/usr/bin/env perl
sub
_git_config {
my
$key
=
shift
;
chomp
(
my
$value
= `git config --get
$key
` );
croak
"Unknown $key"
unless
$value
;
return
$value
;
}
if
( not
@ARGV
== 2 ) {
die
"$0 Repo-Name-Here \"Some Description\""
;
}
my
$github_user
= _git_config(
'github.user'
);
my
$github_token
= _git_config(
'github.token'
);
my
$gh
= Net::GitHub->new(
access_token
=>
$github_token
);
my
$reponame
=
"git\@github.com:"
.
$github_user
.
"/"
.
$ARGV
[0] .
".git"
;
print
"Creating $reponame \n"
;
my
$rp
=
$gh
->repos->create(
{
name
=>
$ARGV
[0],
description
=>
$ARGV
[1],
}
);
system
(
'git'
,
'remote'
,
'add'
,
'origin'
,
$reponame
);