UNPKG

todofordevs

Version:

CLI for TodoForDevs - A simple task management tool for developers

110 lines (109 loc) 4.17 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.registerTaskCommands = registerTaskCommands; const task = __importStar(require("../utils/task")); /** * Register all task-related commands */ function registerTaskCommands(program) { const taskCommand = program .command('task') .description('Task management commands'); // List tasks command taskCommand .command('list') .alias('ls') .description('List tasks for the active project') .option('-p, --project <id>', 'Project ID (overrides active project)') .option('-s, --status <status>', 'Filter by status') .option('-r, --priority <priority>', 'Filter by priority') .option('-a, --assignee <assignee>', 'Filter by assignee') .option('--sort-by <field>', 'Sort by field') .option('--sort-order <order>', 'Sort order (asc or desc)') .action(async (options) => { await task.listTasks(options); }); // Add task command taskCommand .command('add') .description('Add a new task to the active project') .option('-p, --project <id>', 'Project ID (overrides active project)') .action(async (options) => { await task.addTask(options); }); // View task command taskCommand .command('view <taskId>') .description('View details of a specific task') .action(async (taskId) => { await task.viewTask(taskId); }); // Update task command taskCommand .command('update <taskId>') .description('Update an existing task') .action(async (taskId) => { await task.updateTask(taskId); }); // Delete task command taskCommand .command('delete <taskId>') .alias('rm') .description('Delete a task') .action(async (taskId) => { await task.deleteTask(taskId); }); // Add aliases at the program level for common commands program .command('add') .description("Shortcut for 'task add'") .option('-p, --project <id>', 'Project ID (overrides active project)') .action(async (options) => { await task.addTask(options); }); program .command('tasks') .description("Shortcut for 'task list'") .option('-p, --project <id>', 'Project ID (overrides active project)') .option('-s, --status <status>', 'Filter by status') .option('-r, --priority <priority>', 'Filter by priority') .option('-a, --assignee <assignee>', 'Filter by assignee') .option('--sort-by <field>', 'Sort by field') .option('--sort-order <order>', 'Sort order (asc or desc)') .action(async (options) => { await task.listTasks(options); }); }