coryd.dev/cli/lib/tasks/index.js

27 lines
916 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import inquirer from 'inquirer';
import { addPost } from './addPost.js';
import { addLinkToShare } from './addLinkToShare.js';
import { addEpisodeToShow } from './addEpisodeToShow.js';
import { updateReadingProgress } from './updateReadingProgress.js';
import { addBlockedRobot } from './addBlockedRobot.js';
const TASKS = [
{ name: '📄 Add post', handler: addPost },
{ name: '🔗 Add link to share', handler: addLinkToShare },
{ name: ' Add episode to show', handler: addEpisodeToShow },
{ name: '📚 Update reading progress', handler: updateReadingProgress },
{ name: '🤖 Block robot', handler: addBlockedRobot }
];
export const runTasksMenu = async () => {
const { task } = await inquirer.prompt([
{
type: 'list',
name: 'task',
message: 'Select a task to perform:',
choices: TASKS.map((t) => ({ name: t.name, value: t.handler }))
}
]);
await task();
};