adr
Version:
轻量级架构记录工具 - Command-line tools for working with Architecture Decision Records
40 lines • 3.06 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.status = void 0;
let inquirer = require('inquirer');
const utils_1 = require("./utils");
const StatusHelper_1 = require("./StatusHelper");
const Config_1 = require("./Config");
const getAdrFiles_1 = require("./helpers/getAdrFiles");
let path = Config_1.default.getSavePath();
let i18n = utils_1.default.getI18n();
let getAllFilesName = function () {
let outputArray = [''];
let files = getAdrFiles_1.default();
files.forEach(function (file) {
let fileName = file.relativePath;
let index = utils_1.default.getIndexByString(fileName);
if (index) {
outputArray[index] = fileName;
}
});
return outputArray;
};
function status(index) {
let fileName = getAllFilesName()[index];
if (!fileName) {
console.log(`File with index ${index} does not exist.`);
}
let status = StatusHelper_1.default.getLatestStatus(path + fileName);
let statusList = i18n.statusStr.split('/');
inquirer.prompt([{
type: 'list',
name: 'status',
message: `${fileName}(${status}) new status:`,
choices: statusList
}]).then(answer => {
StatusHelper_1.default.setStatus(path + fileName, answer.status);
});
}
exports.status = status;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdHVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9zdGF0dXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFBO0FBRWxDLG1DQUEyQjtBQUMzQixpREFBeUM7QUFDekMscUNBQTZCO0FBQzdCLHVEQUErQztBQUUvQyxJQUFJLElBQUksR0FBRyxnQkFBTSxDQUFDLFdBQVcsRUFBRSxDQUFBO0FBQy9CLElBQUksSUFBSSxHQUFHLGVBQUssQ0FBQyxPQUFPLEVBQUUsQ0FBQTtBQUUxQixJQUFJLGVBQWUsR0FBRztJQUNwQixJQUFJLFdBQVcsR0FBRyxDQUFDLEVBQUUsQ0FB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