UNPKG

sesterce-cli

Version:

A powerful command-line interface tool for managing Sesterce Cloud services. Sesterce CLI provides easy access to GPU cloud instances, AI inference services, container registries, and SSH key management directly from your terminal.

53 lines 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createGpuCloudInstanceOffersCommand = createGpuCloudInstanceOffersCommand; const list_instance_offers_1 = require("@/modules/gpu-cloud/use-cases/list-instance-offers"); function createGpuCloudInstanceOffersCommand(gpuCloudInstanceCommand) { gpuCloudInstanceCommand .command("offers") .description("List all instance offers in Sesterce Cloud") .action(async () => { console.log("Listing instance offers..."); const result = await list_instance_offers_1.listGpuCloudOffers.execute(); if (result.isLeft()) { console.error(result.value.message); return; } const offers = result.value; // const groupedOffers = offers.reduce( // (acc, offer) => { // const key = `${offer.gpuName}x${offer.gpuCount}`; // if (!acc[key]) { // acc[key] = []; // } // acc[key].push(offer); // return acc; // }, // {} as Record<string, GpuCloudInstanceOffer[]> // ); // const offersKeys = Object.keys(groupedOffers).sort((a, b) => // a.localeCompare(b) // ); // const sortedOffers = offersKeys.flatMap((offerKey) => // groupedOffers[offerKey].filter(({ availability }) => // availability.some(({ available }) => available) // ) // ); const tableData = offers.reduce((dict, { offer: { instanceId, ...offer } }) => { dict[instanceId] = { gpu: `${offer.gpuCount} x ${offer.gpuName}`, hourlyPrice: `$${offer.hourlyPrice.toFixed(2)}`, cloud: offer.cloud.name, "vRam (GB)": offer.configuration.vRamGB, "ram (GB)": offer.configuration.ramGB, vcpu: offer.configuration.vCpu, interconnect: offer.configuration.interconnect, nvlink: offer.nvlink ? "Yes" : "No", deploymentType: offer.deploymentType, }; return dict; }, {}); console.table(tableData); }); } //# sourceMappingURL=offers.js.map