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();
console.log(`marking branch '$current' as done`);
console.log(`marking branch '${current}' as done`);
await Git().addConfig( `branch.${current}.mikado-done`, true );

View File

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

View File

@ -1,84 +1,77 @@
const yargs = require("yargs");
const new = require("./commands/new");
const newCommand = require("./commands/new");
const status = require("./commands/status");
const done = require("./commands/done");
const upstream = require("./commands/upstream");
const { currentBranch } = require('./utils');
const { currentBranch } = require("./utils");
currentBranch().then(
currentBranch => {
yargs
.scriptName("git-mikado")
.showHelpOnFail(true)
.command(
"status",
"show status of all mikado branches",
status
)
.command(
"done [branch]",
"set branch as done",
(yargs) => {
return yargs
.positional("branch", {
currentBranch().then((currentBranch) => {
yargs
.scriptName("git-mikado")
.showHelpOnFail(true)
.command("status", "show status of all mikado branches", status)
.command(
"done [branch]",
"set branch as done",
(yargs) => {
return yargs.positional("branch", {
describe: "branch to mark as done",
default: currentBranch
})
},
done
)
.command(
"upstream [upstream]",
"set branch as done",
(yargs) => {
return yargs
.positional("upstream", {
describe: "upstream branch to add",
})
.option("branch", {
alias: "b",
describe: "target branch",
default: currentBranch,
})
.demandOption(["upstream"]);
},
upstream
)
.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
)
.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;
});
},
done
)
.command(
"upstream [upstream]",
"set an upstream of the current branch",
(yargs) => {
return yargs
.positional("upstream", {
describe: "upstream branch to add",
})
.option("branch", {
alias: "b",
describe: "target branch",
default: currentBranch,
})
.demandOption(["upstream"]);
},
upstream
)
.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",
default: currentBranch,
describe:
"branch that is dependent on the new branch",
})
.demandOption(["branch"]);
},
newCommand
)
.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;
});