feat(cli): add support for repeated directus tasks
This commit is contained in:
parent
8a12e83b13
commit
1f9e2d856f
11 changed files with 601 additions and 5 deletions
25
cli/lib/tasks/index.js
Normal file
25
cli/lib/tasks/index.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import inquirer from 'inquirer';
|
||||
import { addPost } from './addPost.js';
|
||||
import { addLinkToShare } from './addLinkToShare.js';
|
||||
import { addEpisodeToShow } from './addEpisodeToShow.js';
|
||||
import { updateReadingProgress } from './updateReadingProgress.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 },
|
||||
];
|
||||
|
||||
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();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue