UNPKG

linear-cmd

Version:

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

48 lines (47 loc) 2.24 kB
#!/usr/bin/env node import { Command } from 'commander'; import { createAccountCommand } from './commands/account/index.js'; import { createCompletionCommand } from './commands/completion.js'; import { createIssueCommand } from './commands/issue/index.js'; import { createUpdateCommand } from './commands/update.js'; import { APP_INFO } from './constants.js'; import { Logger } from './lib/logger.js'; const program = new Command(); program.name('linear').description('Linear CLI - A GitHub CLI-like tool for Linear').version(APP_INFO.version); // Add commands program.addCommand(createAccountCommand()); program.addCommand(createIssueCommand()); program.addCommand(createUpdateCommand()); program.addCommand(createCompletionCommand()); // Global help improvements program.configureHelp({ sortSubcommands: true, subcommandTerm: (cmd) => cmd.name() }); // Custom help program.on('--help', () => { Logger.plain(''); Logger.bold('Examples:'); Logger.plain(' $ linear account add # Add a new account'); Logger.plain(' $ linear account list # List all accounts'); Logger.plain(' $ linear account switch work # Switch to work account'); Logger.plain(' $ linear issue show WORK-123 # Show issue by ID'); Logger.plain(' $ linear issue show <linear-url> # Show issue by URL'); Logger.plain(' $ linear issue branch WORK-123 # Get branch name for issue'); Logger.plain(' $ linear update # Update linear-cmd to latest version'); Logger.plain(' $ linear completion install # Install shell completion'); Logger.plain(''); Logger.bold('Getting Started:'); Logger.plain(' 1. Get your API key from Linear Settings > Account > API'); Logger.plain(' 2. Run: linear account add'); Logger.plain(' 3. Test connection: linear account test'); Logger.plain(' 4. View an issue: linear issue show <issue-id-or-url>'); Logger.plain(''); Logger.dim('For more information, visit: https://linear.app/developers'); }); // Parse arguments program.parse(); // If no command provided, show help if (!process.argv.slice(2).length) { program.outputHelp(); }