UNPKG

@ebuka_dev/git-branch-cleaner

Version:

A CLI tool to help manage and clean up Git branches

48 lines (47 loc) 1.76 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const listAll_1 = require("./commands/listAll"); const cleanMerged_1 = require("./commands/cleanMerged"); const delete_1 = require("./commands/delete"); const listStale_1 = require("./commands/listStale"); const program = new commander_1.Command(); // CLI Configuration program .name("git-branch-cleaner") .description("CLI tool to clean up Git branches") .version("1.0.0"); program .command("list-all") .description("List all branches in the repository") .action(listAll_1.listAllBranches); program .command("clean-merged") .description("List and clean up merged branches") .option("-v, --verbose", "Show detailed branch information") .option("--auto-delete", "Automatically delete branches after listing") .action(async (options) => { await (0, cleanMerged_1.listMergedBranches)(options.verbose, options.autoDelete); }); program .command("delete") .description("Delete branches") .option("--force", "Force delete branches") .argument("[branch...]", "Branch names to delete (optional)") .action(async (branchNames, options) => { if (branchNames && branchNames.length > 0) { await (0, delete_1.deleteStaleBranches)(branchNames, options.force); } else { await (0, delete_1.deleteInteractiveBranches)(options.force); } }); program .command("list-stale") .description("List stale branches (branches with deleted remotes)") .option("-v, --verbose", "Show detailed branch information") .action(async (options) => { await (0, listStale_1.listStaleBranches)(options.verbose); }); program.parse(process.argv);