smartgit/ts/smartgit.init.ts

15 lines
571 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...
2016-07-05 01:47:38 +00:00
let err = new Error("smartgit.init requires an absolute directory path!")
plugins.beautylog.error(err.message);
done.reject("err");
return done.promise;
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;
};