import { Command } from 'commander'; import { generateNotificationsCommandHandler } from './generateNotificationsCommandHandler'; import chalk from 'chalk'; import { configureTaskDetailsCommandHandler } from './configureTaskDetailsCommandHandler'; export function NotifficationCommand(): Command { const notificationCommand = new Command('notifications') .alias('n') .description( 'Provides a list of commands that are helpful for building notifications', ); const generateCommand = new Command('generate') .alias('g') .description( chalk.green(`Generate notifications according to configurations in the project. Use ${chalk.blue('hexasync notifications configure')} to generate configurations.`), ) .option( '-i, --id ', 'The notifficationId in configuration, in case you need to regenerate a specific notification', ) .option( '-o, --output ', 'Generate the appropriate pusher, e.g: Trello, Lark, Email...', 'trello', ) .option( '-e, --entity ', 'The entity to generate the notification for, e.g.: Sales Orders, Inventory Item Quantity', ) .action(generateNotificationsCommandHandler); const configureTaskDetailsCommand = new Command('configure-task-details') .alias('ct') .description( chalk.green( `Preconfigure the task details to be shown in the notification.`, ), ) .option('-i, --id ', 'The Task Id') .action(configureTaskDetailsCommandHandler); notificationCommand.addCommand(generateCommand); notificationCommand.addCommand(configureTaskDetailsCommand); // TODO: the configuration should be generated, too // const configCommand = new Command("configure") // .description(`Generate notification configurations for the project.`) // .action(generateNotifications); // notificationCommand.addCommand(configCommand); return notificationCommand; }