27 lines
911 B
JavaScript
27 lines
911 B
JavaScript
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 run:',
|
||
choices: TASKS.map(t => ({ name: t.name, value: t.handler }))
|
||
}
|
||
]);
|
||
|
||
await task();
|
||
};
|