smartgit/ts/smartgit.add.ts

21 lines
606 B
TypeScript
Raw Normal View History

2016-06-12 14:46:59 +00:00
import * as plugins from "./smartgit.plugins";
2016-07-03 02:37:03 +00:00
import * as helpers from "./smartgit.helpers";
2016-06-12 14:46:59 +00:00
2016-07-03 22:00:04 +00:00
let addAll = (dirPathArg:string) => {
2016-07-03 02:37:03 +00:00
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
2016-07-05 01:47:38 +00:00
let err = new Error("smartgit.add expects a valid git directory!");
plugins.beautylog.error(err.message);
done.reject(err);
2016-07-03 02:37:03 +00:00
return done.promise;
};
// if everything is ok proceed
2016-07-03 22:00:04 +00:00
plugins.shelljs.exec(`(cd ${dirPathArg} && git add -A && git status)`);
2016-07-03 02:37:03 +00:00
done.resolve(dirPathArg);
return done.promise;
};
2016-07-03 22:00:04 +00:00
export let add = {
addAll: addAll
}