UNPKG

@ethersphere/swarm-cli

Version:
38 lines (37 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Enable = void 0; const history_command_1 = require("./history-command"); const text_1 = require("../../utils/text"); const fs_1 = require("fs"); class Enable extends history_command_1.HistoryCommand { constructor() { super(...arguments); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: 'enable' }); Object.defineProperty(this, "description", { enumerable: true, configurable: true, writable: true, value: 'Enable upload history tracking' }); } run() { super.init(); if (this.commandConfig.config.historyEnabled) { this.console.log((0, text_1.warningText)('Upload history tracking is already enabled')); return; } this.commandConfig.setHistoryEnabled(true); const historyFilePath = this.commandConfig.getHistoryFilePath(); if (!(0, fs_1.existsSync)(historyFilePath)) { (0, fs_1.writeFileSync)(historyFilePath, JSON.stringify([])); } this.console.log('Upload history tracking enabled'); } } exports.Enable = Enable;