smartgit/ts/smartgit.clone.ts

28 lines
965 B
TypeScript
Raw Normal View History

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