UNPKG

materials-cli

Version:
30 lines (29 loc) 948 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const configstore_1 = __importDefault(require("configstore")); class ConfigStore { constructor(id) { this.conf = new configstore_1.default(id); } clearConfig() { this.conf.clear(); } getFolderPath() { return this.conf.has("folderPath") ? this.conf.get("folderPath").folderPath : undefined; } setFolderPath(folderPath) { this.conf.set("folderPath", folderPath); } getShortcuts() { return this.conf.get("shortcuts") || {}; } setShortcuts(shortcut, course) { const currentShortcuts = this.getShortcuts(); currentShortcuts[shortcut] = course; this.conf.set("shortcuts", currentShortcuts); } } exports.default = ConfigStore;