sourcecontrol
Version:
A modern TypeScript CLI application for source control
79 lines âĸ 5.47 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.displayInitError = exports.displayReinitializationInfo = exports.displayNextSteps = exports.displayRepositoryStructure = exports.displaySuccessMessage = exports.displayHeader = void 0;
const repo_1 = require("../../core/repo");
const utils_1 = require("../../utils");
const chalk_1 = __importDefault(require("chalk"));
const path_1 = __importDefault(require("path"));
const displayHeader = () => {
utils_1.display.info('đ Source Control Repository Initialization', 'Source Control Repository Initialization');
};
exports.displayHeader = displayHeader;
const displaySuccessMessage = (repoPath, options) => {
const title = chalk_1.default.bold.green('â
Repository Created Successfully!');
const details = [
`${chalk_1.default.gray('đ Location:')} ${chalk_1.default.white(repoPath)}`,
`${chalk_1.default.gray('đˇī¸ Type:')} ${chalk_1.default.white(options.bare ? 'Bare Repository' : 'Standard Repository')}`,
`${chalk_1.default.gray('âī¸ Format:')} ${chalk_1.default.white('Source Control Repository Format v0')}`,
`${chalk_1.default.gray('đ Directory:')} ${chalk_1.default.white('.source/')}`,
].join('\n');
utils_1.display.success(details, title);
};
exports.displaySuccessMessage = displaySuccessMessage;
const displayRepositoryStructure = () => {
const title = chalk_1.default.yellow('đ Repository Structure Created');
const structure = [
`${chalk_1.default.cyan('đ')} ${chalk_1.default.white('.source/')} ${chalk_1.default.gray('Source control metadata directory')}`,
`${chalk_1.default.cyan('đĻ')} ${chalk_1.default.white('âââ objects/')} ${chalk_1.default.gray('Object storage (blobs, trees, commits)')}`,
`${chalk_1.default.cyan('đˇī¸')} ${chalk_1.default.white('âââ refs/')} ${chalk_1.default.gray('References (branches, tags)')}`,
`${chalk_1.default.cyan('đ')} ${chalk_1.default.white('â âââ heads/')} ${chalk_1.default.gray('Branch references')}`,
`${chalk_1.default.cyan('đ')} ${chalk_1.default.white('â âââ tags/')} ${chalk_1.default.gray('Tag references')}`,
`${chalk_1.default.cyan('đ')} ${chalk_1.default.white('âââ HEAD')} ${chalk_1.default.gray('Current branch pointer')}`,
`${chalk_1.default.cyan('âī¸')} ${chalk_1.default.white('âââ config')} ${chalk_1.default.gray('Repository configuration')}`,
`${chalk_1.default.cyan('đ')} ${chalk_1.default.white('âââ description')} ${chalk_1.default.gray('Repository description')}`,
].join('\n');
utils_1.display.highlight(structure, title);
};
exports.displayRepositoryStructure = displayRepositoryStructure;
const displayNextSteps = () => {
const title = chalk_1.default.magenta('đ¯ Next Steps');
const steps = [
`${chalk_1.default.gray('1.')} ${chalk_1.default.green('sc add <file>')} ${chalk_1.default.gray('Add files to staging area')}`,
`${chalk_1.default.gray('2.')} ${chalk_1.default.green('sc commit -m "message"')} ${chalk_1.default.gray('Create your first commit')}`,
`${chalk_1.default.gray('3.')} ${chalk_1.default.green('sc status')} ${chalk_1.default.gray('Check repository status')}`,
`${chalk_1.default.gray('4.')} ${chalk_1.default.green('sc log')} ${chalk_1.default.gray('View commit history')}`,
].join('\n');
const tip = `${chalk_1.default.blue('đĄ Tip:')} Use ${chalk_1.default.green('sc help <command>')} for more information about any command.`;
utils_1.display.highlight(steps + '\n\n' + tip, title);
};
exports.displayNextSteps = displayNextSteps;
const displayReinitializationInfo = (repoPath) => {
const message = [
`The directory ${chalk_1.default.white(repoPath)} already contains a source control repository.`,
'',
`${chalk_1.default.green('â')} Reinitialized existing repository in ${chalk_1.default.white(path_1.default.join(repoPath, repo_1.SourceRepository.DEFAULT_GIT_DIR))}`,
'',
`${chalk_1.default.blue('âšī¸')} No changes were made to the existing repository structure.`,
].join('\n');
utils_1.display.warning(message, chalk_1.default.yellow('â ī¸ Repository Already Exists'));
};
exports.displayReinitializationInfo = displayReinitializationInfo;
const displayInitError = (error) => {
const title = chalk_1.default.red('â Initialization 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 the directory path is valid`,
` ${chalk_1.default.gray('3.')} Verify that the disk has sufficient space`,
` ${chalk_1.default.gray('4.')} Try running the command with elevated privileges if needed`,
];
utils_1.display.error(errorDetails.join('\n'), title);
};
exports.displayInitError = displayInitError;
//# sourceMappingURL=init.display.js.map
;