UNPKG

@jozsefsallai/userv

Version:
27 lines (26 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const node_iro_1 = require("node-iro"); const servers_1 = require("../lib/servers"); const check_1 = require("../lib/check"); class All extends core_1.Command { async forEachAsync(arr, cb) { for (let i = 0; i < arr.length; i++) { await cb(arr[i], i, arr); } } async run() { const allServers = await servers_1.default.get(); this.forEachAsync(allServers, async function (server) { const url = `http://${server.name}.ucoz.net/favicon.ico`; const status = await (0, check_1.isItUp)(url); const output = status ? (0, node_iro_1.default)(`✔️ ${server.name} (${server.family}/${server.ip}): OK`, node_iro_1.green) : (0, node_iro_1.default)(`❌ ${server.name} (${server.family}/${server.ip}): DOWN`, node_iro_1.red); return console.log(output); }); } } exports.default = All; All.description = 'Get a list of all the servers and their status.';