now can work with remotes
This commit is contained in:
@@ -7,3 +7,4 @@ export {init} from "./smartgit.init";
|
||||
export {pull} from "./smartgit.pull";
|
||||
export {push} from "./smartgit.push";
|
||||
export {remote} from "./smartgit.remote";
|
||||
export {status} from "./smartgit.status";
|
||||
|
@@ -6,7 +6,7 @@ export let pull = (dirPathArg:string,sourceArg:string = "", branchArg:string = "
|
||||
if(!helpers.isGitDirectory(dirPathArg)){
|
||||
plugins.beautylog.error("smartgit.pull expects a valid git directory");
|
||||
done.reject();
|
||||
return done.promse;
|
||||
return done.promise;
|
||||
};
|
||||
// if everything is allright proceed
|
||||
plugins.shelljs.exec(`(cd ${dirPathArg} && git pull ${sourceArg} ${branchArg})`);
|
||||
|
@@ -9,7 +9,7 @@ export let push = (dirPathArg:string, sourceArg:string = "", branchArg:string =
|
||||
return done.promise;
|
||||
}
|
||||
// if everything seems allright proceed
|
||||
plugins.shelljs.exec("");
|
||||
plugins.shelljs.exec(`(cd ${dirPathArg} && git status)`);
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
@@ -1,16 +1,60 @@
|
||||
import * as plugins from "./smartgit.plugins";
|
||||
import * as helpers from "./smartgit.helpers";
|
||||
|
||||
let addRemote = (dirPathArg) => {
|
||||
let add = (dirPathArg,remoteNameArg:string, remoteLinkArg:string) => {
|
||||
let done = plugins.Q.defer();
|
||||
|
||||
if(!helpers.isGitDirectory(dirPathArg)){
|
||||
plugins.beautylog.error("smartgit.remote.add expects a valid git directory");
|
||||
done.reject();
|
||||
return done.promise;
|
||||
};
|
||||
if(!remoteNameArg) {
|
||||
plugins.beautylog.error("smartgit.remote.add expects a valid remote name");
|
||||
done.reject();
|
||||
return done.promise;
|
||||
};
|
||||
if(!remoteLinkArg) {
|
||||
plugins.beautylog.error("smartgit.remote.add expects a valid remote link");
|
||||
done.reject();
|
||||
return done.promise;
|
||||
};
|
||||
// if everything is all right proceed
|
||||
plugins.shelljs.exec(`cd ${dirPathArg} && git remote add ${remoteNameArg} ${remoteLinkArg}`);
|
||||
remote.list(dirPathArg);
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let removeRemote = () => {
|
||||
let check = (dirPathArg:string, remoteNameArg:string, remoteLinkArg) => {
|
||||
|
||||
}
|
||||
|
||||
let list = (dirPathArg) => {
|
||||
let done = plugins.Q.defer();
|
||||
let remotes = {};
|
||||
if(!helpers.isGitDirectory(dirPathArg)){
|
||||
plugins.beautylog.error("smartgit.remote.list expects a valid git directory");
|
||||
done.reject();
|
||||
return done.promise;
|
||||
};
|
||||
// if everything is all right proceed
|
||||
plugins.shelljs.exec(`cd ${dirPathArg} && git remote -v`).stdout;
|
||||
done.resolve(remotes);
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let remove = (dirPathArg:string) => {
|
||||
let done = plugins.Q.defer();
|
||||
if(!helpers.isGitDirectory(dirPathArg)){
|
||||
plugins.beautylog.error("smartgit.remote.remove expects a valid git directory");
|
||||
done.reject();
|
||||
return done.promise;
|
||||
};
|
||||
// if everything is all right
|
||||
}
|
||||
|
||||
export let remote = {
|
||||
add: addRemote,
|
||||
remove: removeRemote
|
||||
add: add,
|
||||
list: list,
|
||||
remove: remove
|
||||
}
|
15
ts/smartgit.status.ts
Normal file
15
ts/smartgit.status.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import * as plugins from "./smartgit.plugins";
|
||||
import * as helpers from "./smartgit.helpers";
|
||||
|
||||
export let status = (dirPathArg:string) => {
|
||||
let done = plugins.Q.defer();
|
||||
if(!helpers.isGitDirectory(dirPathArg)){
|
||||
plugins.beautylog.error("smartgit.status expects a valid git directory");
|
||||
done.reject();
|
||||
return done.promise;
|
||||
}
|
||||
// if everything seems allright proceed
|
||||
plugins.shelljs.exec(`(cd ${dirPathArg} && git status)`);
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
Reference in New Issue
Block a user