smartgit/ts/smartgit.commit.ts

15 lines
568 B
TypeScript
Raw Normal View History

2016-07-03 02:03:15 +00:00
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
2016-03-30 23:59:45 +00:00
2016-07-03 02:03:15 +00:00
export let commit = (dirPathArg:string,commitMessage:string) => {
let done = plugins.Q.defer();
2016-07-03 02:03:15 +00:00
if(!plugins.smartfile.fs.isDirectory(plugins.path.join(dirPathArg,".git"))){
plugins.beautylog.error("smartgit.commit expects a valid git directory");
done.reject();
return done.promise;
};
// if everything is all right proceed
plugins.shelljs.exec(`git commit -m "${commitMessage}"`);
done.resolve();
return done.promise;
2016-03-30 23:59:45 +00:00
};