sourcecontrol
Version:
A modern TypeScript CLI application for source control
76 lines âĸ 4.33 kB
JavaScript
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
;