UNPKG

plazbot-cli

Version:
34 lines (33 loc) 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addLinkCommand = void 0; const commander_1 = require("commander"); const plazbot_1 = require("plazbot"); const credentials_1 = require("../../utils/credentials"); exports.addLinkCommand = new commander_1.Command('add-link') .description('Agregar un enlace al portal') .argument('<portalId>', 'ID del portal') .requiredOption('-t, --title <title>', 'Título del enlace') .requiredOption('-u, --url <url>', 'URL del enlace') .option('--dev', 'Usar entorno de desarrollo') .action(async (portalId, options) => { try { const credentials = await (0, credentials_1.getStoredCredentials)(); const portal = new plazbot_1.Portal({ workspaceId: credentials.workspace, apiKey: credentials.apiKey, zone: credentials.zone, ...(options.dev && { customUrl: "http://localhost:5090" }) }); await portal.addLinkToPortal({ portalId, value: options.title, url: options.url }); console.log('✅ Enlace agregado exitosamente'); } catch (error) { console.error('❌ Error al agregar el enlace:', error.message); process.exit(1); } });