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.

59 lines 2.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createRegistryDeleteCommand = createRegistryDeleteCommand; const delete_registry_1 = require("@/modules/registries/use-cases/delete-registry"); const list_registries_1 = require("@/modules/registries/use-cases/list-registries"); const prompts_1 = require("@inquirer/prompts"); const printRegistry = (registry) => { return `${registry.name} - ${registry.url} - ${registry.username}`; }; function createRegistryDeleteCommand(registryCommand) { registryCommand .command("delete") .description("Delete a registry") .option("-i, --registry-id <registryId>", "The ID of the registry to delete") .action(async (args) => { let registryId = args.registryId; if (!registryId) { console.log("Loading registries..."); const registriesResult = await list_registries_1.listRegistries.execute(); if (registriesResult.isLeft()) { console.error(registriesResult.value.message); return; } const registries = registriesResult.value; if (registries.length === 0) { console.log("No registries found"); return; } const selectedRegistry = await (0, prompts_1.search)({ message: "Select a registry to update", source: async (input, { signal }) => { if (!input) { return registries.map((registry) => ({ name: printRegistry(registry), value: registry, })); } return registries .filter((registry) => registry.name.toLowerCase().includes(input.toLowerCase()) || registry.url.toLowerCase().includes(input) || registry.username.toLowerCase().includes(input)) .map((registry) => ({ name: printRegistry(registry), value: registry, })); }, }); registryId = selectedRegistry._id; } console.log("Deleting registry..."); const result = await delete_registry_1.deleteRegistry.execute(registryId); if (result.isLeft()) { console.error(result.value.message); return; } console.log("Registry deleted successfully!"); }); } //# sourceMappingURL=delete.js.map