This commit is contained in:
Yanick Champoux 2021-11-18 19:54:41 -05:00
parent 67c9964997
commit f497fde8ad
4 changed files with 86 additions and 78 deletions

17
TODO Normal file
View File

@ -0,0 +1,17 @@
- show icons for branches
👷 - U+1F477 - CONSTRUCTION WORKER
🤝
🙋 - U+1F64B - HAPPY PERSON RAISING ONE HAND
🍷 - U+1F377 - WINE GLASS
🍸 - U+1F378 - COCKTAIL GLASS
🔍 - U+1F50D - LEFT-POINTING MAGNIFYING GLASS
🔎 - U+1F50E - RIGHT-POINTING MAGNIFYING GLASS
🥃 - U+1F943 - TUMBLER GLASS
🥛 - U+1F95B - GLASS OF MILK
🥃 - U+1F943 - TUMBLER GLASS
✨ - U+02728 - SPARKLES
⛔ - U+026D4 - NO ENTRY
🚫 - U+1F6AB - NO ENTRY SIGN
- list branch in cyclic order

View File

@ -8,7 +8,7 @@ module.exports = async (yargs) => {
const current = await currentBranch(); const current = await currentBranch();
console.log(`marking branch '$current' as done`); console.log(`marking branch '${current}' as done`);
await Git().addConfig( `branch.${current}.mikado-done`, true ); await Git().addConfig( `branch.${current}.mikado-done`, true );

View File

@ -40,9 +40,7 @@ module.exports = async (yargs) => {
await checkWorkspaceClean(); await checkWorkspaceClean();
const branch = yargs.branch; const {branch,upstream} = yargs;
const upstream = await currentBranch();
const base = yargs.base ?? await getBaseBranch(upstream); const base = yargs.base ?? await getBaseBranch(upstream);

View File

@ -1,39 +1,31 @@
const yargs = require("yargs"); const yargs = require("yargs");
const new = require("./commands/new"); const newCommand = require("./commands/new");
const status = require("./commands/status"); const status = require("./commands/status");
const done = require("./commands/done"); const done = require("./commands/done");
const upstream = require("./commands/upstream"); const upstream = require("./commands/upstream");
const { currentBranch } = require('./utils'); const { currentBranch } = require("./utils");
currentBranch().then(
currentBranch => {
currentBranch().then((currentBranch) => {
yargs yargs
.scriptName("git-mikado") .scriptName("git-mikado")
.showHelpOnFail(true) .showHelpOnFail(true)
.command( .command("status", "show status of all mikado branches", status)
"status",
"show status of all mikado branches",
status
)
.command( .command(
"done [branch]", "done [branch]",
"set branch as done", "set branch as done",
(yargs) => { (yargs) => {
return yargs return yargs.positional("branch", {
.positional("branch", {
describe: "branch to mark as done", describe: "branch to mark as done",
default: currentBranch default: currentBranch,
}) });
}, },
done done
) )
.command( .command(
"upstream [upstream]", "upstream [upstream]",
"set branch as done", "set an upstream of the current branch",
(yargs) => { (yargs) => {
return yargs return yargs
.positional("upstream", { .positional("upstream", {
@ -62,11 +54,13 @@ yargs
}) })
.option("upstream", { .option("upstream", {
alias: "u", alias: "u",
describe: "branch that is dependent on the new branch", default: currentBranch,
describe:
"branch that is dependent on the new branch",
}) })
.demandOption(["branch"]); .demandOption(["branch"]);
}, },
new newCommand
) )
.fail((msg, err, yargs) => { .fail((msg, err, yargs) => {
try { try {
@ -80,5 +74,4 @@ yargs
.help() .help()
.demandCommand(1, "") .demandCommand(1, "")
.strict().argv; .strict().argv;
}); });