#!/usr/bin/env perl

use strict;
use warnings;
use Config::General;
use Net::SSH::Perl;

if (! @ARGV) {
  print "USAGE: prj-create-repo.pl 'login\@host:path/project.git'\n";
  exit;
}

my ($login, $host) = split(/@/, shift);
my $path;
($host, $path) = split(/:/, $host);

print "Logging to $host...\n";
my $ssh = Net::SSH::Perl->new($host, debug => 0);
$ssh->login($login, "");

print "Creating remote Git Repository...\n";
my ($stdout, $stderr, $exit) = $ssh->cmd("mkdir $path && cd $path && git init --bare");
print $stdout;
