UNPKG

use-multiple-gits

Version:

CLI tool to manage multiple git configurations (user.name, user.email, SSH keys) with easy switching between identities

32 lines 1.36 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.hookCommand = void 0; const chalk_1 = __importDefault(require("chalk")); const gitHooks_1 = require("../utils/gitHooks"); const hookCommand = async (action) => { try { if (action === 'install') { await (0, gitHooks_1.installPreCommitHook)(); console.log(chalk_1.default.green('\n✅ Pre-commit hook installed successfully!\n')); console.log(chalk_1.default.cyan('The hook will verify your git identity before each commit.\n')); } else if (action === 'uninstall') { await (0, gitHooks_1.uninstallPreCommitHook)(); console.log(chalk_1.default.green('\n✅ Pre-commit hook uninstalled successfully!\n')); } else { console.error(chalk_1.default.red(`\n❌ Unknown action: ${action}\n`)); console.log(chalk_1.default.yellow('Usage: multiGit hook <install|uninstall>\n')); process.exit(1); } } catch (error) { console.error(chalk_1.default.red(`\n❌ Error: ${error.message}\n`)); process.exit(1); } }; exports.hookCommand = hookCommand; //# sourceMappingURL=hook.js.map