Files
git-utilities/bin/creature-end
2019-07-20 09:21:10 -04:00

34 lines
839 B
JavaScript
Executable File

#!/usr/bin/env node
const _ = require("lodash");
const path = x => require("../" + x);
const git = path("js/git");
const shell = path("js/shell");
const commander = path("js/commander");
const validate = path("js/validate");
function endFeatureBranch(dp) {
const cmds = [
`git checkout ${dp.branch.standard}`,
`git branch -d ${dp.branch.current}`
];
const remoteBranch = _.get(dp, "branch.remote", false);
if (remoteBranch) {
cmds.push(`git push origin :${remoteBranch}`);
}
return shell.pipeline(cmds);
}
commander
.start()
.then(git.gather)
.then(commander.echo)
// .then(git.setCurrentBranch)
// .then(git.parseCurrentBranch)
// .then(validate.mustBeFeatureBranch)
// .then(git.setStandardBranch)
// .then(git.isBranchRemote)
// .then(endFeatureBranch)
.catch(err => console.error(err));