smartgit/ts/smartgit.clone.ts

24 lines
859 B
TypeScript
Raw Normal View History

2016-03-30 23:26:40 +00:00
/// <reference path="./typings/main.d.ts" />
import plugins = require("./smartgit.plugins");
import SmartgitCheck = require("./smartgit.check");
2015-11-13 21:58:20 +00:00
2016-03-30 23:26:40 +00:00
export = function(options){
2015-11-13 21:58:20 +00:00
2016-03-30 23:26:40 +00:00
/***** URL Checks ******/
if (options.from == "undefined" || options.to == "undefined") {
plugins.beautylog.error("smartgit.clone".blue + " : Something is strange about the way you invoked the function");
return;
}
2015-11-13 21:58:20 +00:00
2016-03-30 23:26:40 +00:00
/***** Path Checks ******/
if (!/^\/.*/.test(options.to)){ //check wether path is absolute
plugins.beautylog.error("It seems that the given path " + options.to + " is not absolute.");
return;
}
2015-11-13 21:58:20 +00:00
2016-03-30 23:26:40 +00:00
plugins.beautylog.log("Now cloning " + options.from);
var cloneOptions:any = {};
var cloneRepository = plugins.nodegit.Clone(options.from, options.to, cloneOptions);
SmartgitCheck(cloneRepository);
};