UNPKG

@ethersphere/swarm-cli

Version:
42 lines (41 loc) 1.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Disable = void 0; const history_command_1 = require("./history-command"); const text_1 = require("../../utils/text"); const fs_1 = require("fs"); class Disable extends history_command_1.HistoryCommand { constructor() { super(...arguments); Object.defineProperty(this, "name", { enumerable: true, configurable: true, writable: true, value: 'disable' }); Object.defineProperty(this, "description", { enumerable: true, configurable: true, writable: true, value: 'Disable upload history tracking' }); } async run() { super.init(); const historyFileExists = (0, fs_1.existsSync)(this.commandConfig.getHistoryFilePath()); if (!this.commandConfig.config.historyEnabled && !historyFileExists) { this.console.log((0, text_1.warningText)('Upload history tracking is already disabled and no history file exists')); return; } if (!this.quiet && !this.yes && historyFileExists) { this.yes = await this.console.confirm('Do you want to delete the upload history file? This action cannot be undone.'); } if (this.yes && historyFileExists) { (0, fs_1.unlinkSync)(this.commandConfig.getHistoryFilePath()); this.console.log('Upload history file deleted'); } this.commandConfig.setHistoryEnabled(false); this.console.log('Upload history tracking disabled'); } } exports.Disable = Disable;