smartgit/ts/smartgit.init.ts

13 lines
489 B
TypeScript
Raw Normal View History

2016-03-30 23:59:45 +00:00
import plugins = require("./smartgit.plugins");
2016-07-03 02:03:15 +00:00
export let init = (dirPathArg:string) => {
let done = plugins.Q.defer();
if (typeof dirPathArg == "undefined") { //lets check if a destination is defined...
plugins.beautylog.error("smartgit.init requires an absolute directory path!");
return;
2016-03-30 23:59:45 +00:00
};
2016-07-03 02:03:15 +00:00
plugins.smartfile.fs.ensureDir(dirPathArg);
plugins.shelljs.exec(`(cd ${dirPathArg} && git init)`);
done.resolve(dirPathArg);
return done.promise;
};