import { Command, CommandRunner } from 'nest-commander'; import { firstValueFrom, tap } from 'rxjs'; import { CommanderService } from '../commander.service.js'; @Command({ name: 'create-tenant', description: 'Create a new tenant', arguments: '[label]', }) export class CreateTenantCommand extends CommandRunner { public constructor(private readonly service: CommanderService) { super(); } public async run([label]: string[]) { await firstValueFrom( this.service.createTenant(label).pipe( tap((data) => { console.log(`Tenant "${label}" created with id: ${data.id}`); }), ), ); } }