UNPKG

sourcecontrol

Version:

A modern TypeScript CLI application for source control

76 lines â€ĸ 4.33 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.displayDestroyError = exports.displayNoRepositoryInfo = exports.displayConfirmationPrompt = exports.displayWarningMessage = exports.displaySuccessMessage = exports.displayHeader = void 0; const repo_1 = require("../../core/repo"); const utils_1 = require("../../utils"); const chalk_1 = __importDefault(require("chalk")); const displayHeader = () => { utils_1.display.info('đŸ’Ĩ Source Control Repository Destruction', 'Source Control Repository Destruction'); }; exports.displayHeader = displayHeader; const displaySuccessMessage = (repoPath) => { const title = chalk_1.default.bold.green('✅ Repository Destroyed Successfully!'); const details = [ `${chalk_1.default.gray('📍 Location:')} ${chalk_1.default.white(repoPath)}`, `${chalk_1.default.gray('đŸ—‘ī¸ Action:')} ${chalk_1.default.white('Source Control Repository Removed')}`, `${chalk_1.default.gray('📁 Directory:')} ${chalk_1.default.white(`${repo_1.SourceRepository.DEFAULT_GIT_DIR} ${chalk_1.default.red('removed')}`)}`, `${chalk_1.default.gray('📄 Files:')} ${chalk_1.default.white('Working directory files preserved')}`, ].join('\n'); utils_1.display.success(details, title); }; exports.displaySuccessMessage = displaySuccessMessage; const displayWarningMessage = () => { const title = chalk_1.default.yellow('âš ī¸ Important Notice'); const warning = [ `${chalk_1.default.red('đŸ”Ĩ')} ${chalk_1.default.white('All version control history has been permanently deleted')}`, `${chalk_1.default.yellow('📄')} ${chalk_1.default.white('Working directory files have been preserved')}`, `${chalk_1.default.blue('💡')} ${chalk_1.default.white('To restore version control, run:')} ${chalk_1.default.green('sc init')}`, ].join('\n'); utils_1.display.warning(warning, title); }; exports.displayWarningMessage = displayWarningMessage; const displayConfirmationPrompt = async (repoPath) => { const title = chalk_1.default.red('âš ī¸ Confirm Repository Destruction'); const warning = [ `We are going to ${chalk_1.default.red('permanently delete')} the source control repository in:`, `${chalk_1.default.white(repoPath)}`, '', `${chalk_1.default.yellow('This action will:')}`, `${chalk_1.default.red('✗')} Delete all commit history`, `${chalk_1.default.red('✗')} Delete all branches and tags`, `${chalk_1.default.red('✗')} Delete all repository metadata`, `${chalk_1.default.green('✓')} Preserve working directory files`, '', ].join('\n'); utils_1.display.warning(warning, title); }; exports.displayConfirmationPrompt = displayConfirmationPrompt; const displayNoRepositoryInfo = (targetPath) => { const title = chalk_1.default.yellow('â„šī¸ No Repository Found'); const message = [ `No source control repository found in ${chalk_1.default.white(targetPath)} or any parent directories.`, '', `${chalk_1.default.blue('💡')} To initialize a new repository, run: ${chalk_1.default.green('sc init')}`, ].join('\n'); utils_1.display.warning(message, title); }; exports.displayNoRepositoryInfo = displayNoRepositoryInfo; const displayDestroyError = (error) => { const title = chalk_1.default.red('❌ Destruction Failed'); const errorDetails = [ `${chalk_1.default.red('📋 Error Details:')}`, ` └─ ${chalk_1.default.white(error.message)}`, '', `${chalk_1.default.yellow('🔧 Troubleshooting:')}`, ` ${chalk_1.default.gray('1.')} Check if you have write permissions to the directory`, ` ${chalk_1.default.gray('2.')} Ensure no processes are using files in the .source directory`, ` ${chalk_1.default.gray('3.')} Try running the command with elevated privileges if needed`, ` ${chalk_1.default.gray('4.')} Verify that the repository exists and is accessible`, ]; utils_1.display.error(errorDetails.join('\n'), title); }; exports.displayDestroyError = displayDestroyError; //# sourceMappingURL=destroy.display.js.map