UNPKG

use-multiple-gits

Version:

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

68 lines 2.36 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.getShellConfigPath = exports.detectShell = void 0; const os = __importStar(require("os")); const detectShell = () => { const platform = os.platform(); const shell = process.env.SHELL || ''; if (platform === 'win32') { return 'powershell'; } if (shell.includes('zsh')) { return 'zsh'; } if (shell.includes('bash')) { return 'bash'; } return 'unknown'; }; exports.detectShell = detectShell; const getShellConfigPath = () => { const shell = (0, exports.detectShell)(); const { ZSHRC_PATH, PROFILE_PATH } = require('./paths'); if (shell === 'zsh') { return ZSHRC_PATH; } if (shell === 'bash') { return PROFILE_PATH; } if (shell === 'powershell') { return PROFILE_PATH; } return ZSHRC_PATH; // Default fallback }; exports.getShellConfigPath = getShellConfigPath; //# sourceMappingURL=shellDetector.js.map