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
32 lines • 1.23 kB
JavaScript
import { BaseCommand } from './BaseCommand.js';
import { getViewerFormatter } from '../formatters/index.js';
import { logger } from '../services/logger.js';
import { Progress } from '../ui/progress.js';
export class ShowViewer extends BaseCommand {
constructor(options) {
super(options);
}
async execute(options) {
await this.ensureInitialized();
const format = options.format || 'plain';
const spinner = Progress.spinner('Fetching viewer…', { format });
try {
const data = await this.client.getViewer();
spinner.stop();
if (!data?.viewer) {
throw new Error('Invalid response format: missing viewer data');
}
const formatter = getViewerFormatter(format);
const output = formatter.formatViewer(data, { 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=ShowViewer.js.map