@ethersphere/swarm-cli
Version:
CLI tool for Bee
46 lines (45 loc) • 1.81 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Status = void 0;
const history_command_1 = require("./history-command");
const chalk_1 = __importDefault(require("chalk"));
const fs_1 = require("fs");
const history_1 = require("../../service/history");
class Status extends history_command_1.HistoryCommand {
constructor() {
super(...arguments);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'status'
});
Object.defineProperty(this, "alias", {
enumerable: true,
configurable: true,
writable: true,
value: 'st'
});
Object.defineProperty(this, "description", {
enumerable: true,
configurable: true,
writable: true,
value: 'Check if upload history tracking is enabled'
});
}
run() {
super.init();
const statusText = this.commandConfig.config.historyEnabled ? chalk_1.default.green('active') : chalk_1.default.yellow('inactive');
this.console.log(chalk_1.default.green.bold('Upload history tracking status:'));
this.console.log(`Status: ${statusText}`);
if ((0, fs_1.existsSync)(this.commandConfig.getHistoryFilePath())) {
this.console.log(`History file path: ${this.commandConfig.getHistoryFilePath()}`);
const history = new history_1.History(this.commandConfig, this.console);
this.console.log(`Number of history entries: ${history.getItems().length}`);
}
}
}
exports.Status = Status;