UNPKG

linear-cmd

Version:

A GitHub CLI-like tool for Linear - manage issues, accounts, and more

26 lines (25 loc) 1.07 kB
import { Command } from 'commander'; import { LinearAPIClient } from '../../lib/linear-client.js'; import { logger } from '../../lib/logger.js'; import {} from '../../schemas/definitions/project.js'; import { CommandNames, SubCommandNames } from '../../schemas/definitions.js'; import { createSubCommandFromSchema } from '../../schemas/utils.js'; export function createShowProjectCommand() { return createSubCommandFromSchema(CommandNames.PROJECT, SubCommandNames.PROJECT_SHOW, async (idOrUrl, options) => { try { const linearClient = new LinearAPIClient(); logger.loading('Fetching project details...'); const projectData = await linearClient.getProjectByIdOrUrl(idOrUrl); if (options.format === 'json') { logger.json(projectData); } else { logger.plain(linearClient.formatProject(projectData)); } } catch (error) { logger.error('Error fetching project', error); process.exit(1); } }); }