git-mikado/src/commands/done.js

29 lines
727 B
JavaScript
Raw Normal View History

2021-11-25 19:01:49 +00:00
const Git = require("simple-git");
const inquirer = require("inquirer");
const report = require("yurnalist");
const _ = require("lodash");
2021-11-25 19:17:36 +00:00
const fp = require("lodash/fp");
2021-11-01 14:03:49 +00:00
2021-11-25 19:01:49 +00:00
const myGit = require("../branches");
const log = require("../log");
2021-11-01 14:03:49 +00:00
2021-11-25 19:01:49 +00:00
module.exports = async (yargs) => {
if (!(await myGit.isClean())) {
log.error("workspace not clean, aborting");
}
2021-11-01 14:03:49 +00:00
2021-11-25 19:01:49 +00:00
const current = await myGit.currentBranch();
2021-11-01 14:03:49 +00:00
2021-11-25 19:17:36 +00:00
log.success(`W00t! marking branch '${current}' as done\n`);
2021-11-01 14:03:49 +00:00
2021-11-25 19:01:49 +00:00
await Git().addConfig(`branch.${current}.mikado-done`, true);
2021-11-25 19:17:36 +00:00
log.info(
"upstreams to merge with:",
await Git()
.getConfig(`branch.${current}.mikado-upstream`)
.then(fp.get("values"))
.then((x) => x.join(", "))
);
2021-11-25 19:01:49 +00:00
};