git-mikado/src/git-mikado.js

45 lines
1.2 KiB
JavaScript

const yargs = require("yargs");
const new_branch = require("./commands/new_branch");
const status = require("./commands/status");
yargs
.scriptName("git-mikado")
.showHelpOnFail(true)
.command(
"status",
"show status of all mikado branches",
status
)
.command(
"new [branch]",
"create new mikado branch",
(yargs) => {
return yargs
.positional("branch", {
describe: "name of the new branch",
})
.option("base", {
alias: "b",
describe: "base branch",
})
.option("upstream", {
alias: "u",
describe: "branch that is dependent on the new branch",
})
.demandOption(["branch"]);
},
new_branch
)
.fail((msg, err, yargs) => {
try {
const message = msg || err.message;
console.error(message);
process.exit(1);
} catch (e) {
yargs.showHelp();
}
})
.help()
.demandCommand(1, "")
.strict().argv;