UNPKG

plazbot-cli

Version:
22 lines (20 loc) 800 B
import { Command } from 'commander'; import { removeCredentials } from '../../utils/credentials'; import { logger } from '../../utils/logger'; import { BaseCommandOptions } from '../../types/common'; export const logoutCommand = new Command('finish') .description('Elimina la configuración local del usuario') .option('--dev', 'Usar ambiente de desarrollo', false) .action(async (options: BaseCommandOptions) => { try { await removeCredentials(); logger.success('Has cerrado sesión correctamente'); if (options.dev) { logger.warning('Ambiente: desarrollo'); } } catch (error) { const message = error instanceof Error ? error.message : 'Error desconocido al cerrar sesión'; logger.error(message); process.exit(1); } });