plazbot-cli
Version:
CLI para Plazbot SDK
27 lines (24 loc) • 1.01 kB
text/typescript
import { Command } from 'commander';
import { Portal } from 'plazbot';
import { getStoredCredentials } from '../../utils/credentials';
import { BaseCommandOptions } from '../../types/common';
export const clearLinksCommand = new Command('clear-links')
.description('Eliminar todos los enlaces del portal')
.argument('<portalId>', 'ID del portal')
.option('--dev', 'Usar entorno de desarrollo')
.action(async (portalId: string, options: BaseCommandOptions) => {
try {
const credentials = await getStoredCredentials();
const portal = new Portal({
workspaceId: credentials.workspace,
apiKey: credentials.apiKey,
zone: credentials.zone,
...(options.dev && { customUrl: "http://localhost:5090" })
});
await portal.clearLinks(portalId);
console.log('✅ Enlaces eliminados exitosamente');
} catch (error: unknown) {
console.error('❌ Error al eliminar los enlaces:', (error as Error).message);
process.exit(1);
}
});