UNPKG

@s-hiroshi/bks

Version:

Cli bookmarks application

40 lines 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RemoveControl = void 0; const inquirer = require("inquirer"); const createChoices_1 = require("../service/createChoices"); class RemoveControl { constructor(reader, writer) { this.reader = reader; this.writer = writer; this.controlCharactor = "rm"; } getControlCharactor() { return this.controlCharactor; } async execute() { let choices = this.reader.readAll().map((item) => { return `${item.keyword}::${item.content}`; }); choices = (0, createChoices_1.createChoices)(choices, ["Exit"]); inquirer .prompt([ { type: "list", name: "context", message: "Which one do you want to remove", choices: choices, loop: false, }, ]) .then((answer) => { if (answer.context !== "Exit") { const choiced = answer.context.split("::"); this.writer.delete(choiced[0], choiced[1]); console.log("Completed"); } }); } } exports.RemoveControl = RemoveControl; //# sourceMappingURL=RemoveControl.js.map