From a40aba0eb3ed9b71d9a4c0e976c231646a428b10 Mon Sep 17 00:00:00 2001 From: Nimit Kalra Date: Thu, 5 Mar 2015 16:14:27 -0600 Subject: [PATCH] Added easy GitHub cloning. --- bin/gg | 7 ++++++- lib/gg.js | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/gg b/bin/gg index 75581ae..05b8c05 100755 --- a/bin/gg +++ b/bin/gg @@ -20,7 +20,12 @@ switch (cli.command) { case 'cl': case 'clone': var repository = cli.args[0]; - gg.clone(repository); + + if (repository.substring(0, 7) == 'http://') { // URL. + gg.cloneURL(repository); + } else { + gg.cloneGitHub(repository); + } break; // Add. diff --git a/lib/gg.js b/lib/gg.js index 7f7df44..89ae952 100644 --- a/lib/gg.js +++ b/lib/gg.js @@ -17,7 +17,7 @@ exports.init = function() { }); }; -exports.clone = function(repository) { +exports.cloneURL = function(repository) { // Nothing to clone. if (!repository) { console.log(notice('[~] You must enter a repository URL.')); @@ -40,6 +40,10 @@ exports.clone = function(repository) { } }; +exports.cloneGitHub = function(repository) { + exports.cloneURL('https://github.com/' + repository + '.git'); +} + exports.addAll = function() { exec('git add -A');