diff --git a/TODO b/TODO new file mode 100644 index 0000000..9ab1b9e --- /dev/null +++ b/TODO @@ -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 diff --git a/src/commands/done.js b/src/commands/done.js index 99e70bf..0bdee48 100644 --- a/src/commands/done.js +++ b/src/commands/done.js @@ -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 ); diff --git a/src/commands/new.js b/src/commands/new.js index 4849897..77d28bb 100644 --- a/src/commands/new.js +++ b/src/commands/new.js @@ -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); diff --git a/src/git-mikado.js b/src/git-mikado.js index 8488b7b..2440a1c 100644 --- a/src/git-mikado.js +++ b/src/git-mikado.js @@ -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; });