UNPKG

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

52 lines 2.43 kB
import { getPipelineFormatter } from './pipelines/index.js'; import { getBuildFormatter } from './builds/index.js'; import { getViewerFormatter } from './viewer/index.js'; import { getOrganizationFormatter } from './organizations/index.js'; import { getErrorFormatter } from './errors/index.js'; import { getTokenFormatter } from './token/index.js'; import { getAnnotationFormatter } from './annotations/index.js'; import { getBuildDetailFormatter } from './build-detail/index.js'; export var FormatterType; (function (FormatterType) { FormatterType["PIPELINE"] = "pipeline"; FormatterType["BUILD"] = "build"; FormatterType["VIEWER"] = "viewer"; FormatterType["ORGANIZATION"] = "organization"; FormatterType["ERROR"] = "error"; FormatterType["TOKEN"] = "token"; FormatterType["ANNOTATION"] = "annotation"; FormatterType["BUILD_DETAIL"] = "build-detail"; })(FormatterType || (FormatterType = {})); export class FormatterFactory { /** * Get the appropriate formatter based on the type and format * @param type The formatter type ('pipeline', 'build', 'viewer', 'organization', 'error', 'token', 'annotation') * @param format The format to use ('plain', 'json', 'alfred') * @returns The appropriate formatter instance */ static getFormatter(type, format = 'plain') { // Normalize the format string const normalizedFormat = format.toLowerCase().trim(); switch (type) { case FormatterType.PIPELINE: return getPipelineFormatter(normalizedFormat); case FormatterType.BUILD: return getBuildFormatter(normalizedFormat); case FormatterType.VIEWER: return getViewerFormatter(normalizedFormat); case FormatterType.ORGANIZATION: return getOrganizationFormatter(normalizedFormat); case FormatterType.ERROR: return getErrorFormatter(normalizedFormat); case FormatterType.TOKEN: return getTokenFormatter(normalizedFormat); case FormatterType.ANNOTATION: return getAnnotationFormatter(normalizedFormat); case FormatterType.BUILD_DETAIL: return getBuildDetailFormatter(normalizedFormat); default: throw new Error(`Unknown formatter type: ${type}`); } } } //# sourceMappingURL=FormatterFactory.js.map