use-multiple-gits
Version:
CLI tool to manage multiple git configurations (user.name, user.email, SSH keys) with easy switching between identities
37 lines ⢠1.69 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.listCommand = void 0;
const chalk_1 = __importDefault(require("chalk"));
const configStorage_1 = require("../utils/configStorage");
const listCommand = async () => {
try {
const initialized = await (0, configStorage_1.isInitialized)();
if (!initialized) {
console.log(chalk_1.default.yellow('â ď¸ Multi-Git not initialized. Run: multiGit init\n'));
return;
}
const configs = await (0, configStorage_1.getAllConfigs)();
if (configs.length === 0) {
console.log(chalk_1.default.yellow('No configurations found. Add one with: multiGit add <name>\n'));
return;
}
console.log(chalk_1.default.blue('\nđ Configured Git Identities:\n'));
configs.forEach((config, index) => {
console.log(chalk_1.default.cyan(`${index + 1}. ${config.displayName || config.name}`));
console.log(chalk_1.default.gray(` Name: ${config.userName}`));
console.log(chalk_1.default.gray(` Email: ${config.userEmail}`));
console.log(chalk_1.default.gray(` SSH Key: ~/.ssh/${config.sshKeyName}`));
console.log(chalk_1.default.gray(` Command: use-${config.name}`));
console.log('');
});
}
catch (error) {
console.error(chalk_1.default.red(`\nâ Error: ${error.message}\n`));
process.exit(1);
}
};
exports.listCommand = listCommand;
//# sourceMappingURL=list.js.map