bktide
Version:
Command-line interface for Buildkite CI/CD workflows with rich shell completions (Fish, Bash, Zsh) and Alfred workflow integration for macOS power users
33 lines • 1.36 kB
JavaScript
import { BaseCommand } from './BaseCommand.js';
import { logger } from '../services/logger.js';
import { FormatterType } from '../formatters/index.js';
import { Progress } from '../ui/progress.js';
export class ListOrganizations extends BaseCommand {
constructor(options) {
super(options);
}
async execute(options = {}) {
const format = options.format || 'plain';
const spinner = Progress.spinner('Fetching organizations…', { format });
try {
const organizations = await this.client.getOrganizations();
spinner.stop();
if (options.debug) {
logger.debug(`Fetched ${organizations.length} organizations`);
}
// Get the appropriate formatter
const formatter = this.getFormatter(FormatterType.ORGANIZATION, options);
// Format and output the organizations
const output = formatter.formatOrganizations(organizations, { debug: options.debug, tips: options.tips });
logger.console(output);
// Success is implicit - data display confirms retrieval
return 0; // Success
}
catch (error) {
spinner.stop();
this.handleError(error, options.debug);
return 1; // Error
}
}
}
//# sourceMappingURL=ListOrganizations.js.map