crunz icon indicating copy to clipboard operation
crunz copied to clipboard

Non-numeric identifier for run individual task

Open judgedim opened this issue 2 years ago • 10 comments

Description
Currently we can run individual task only using dynamic numeric id -t, --task=TASK Which task to run. Provide task number from schedule:list command. Which does not guarantee that it does the same task every time.

What do you think for introduce non-numeric identifier which can be used alongside with numeric id for run command in more predictable way?

Example

<?php

use Crunz\Schedule;

$schedule = new Schedule();
$task = $schedule->run(PHP_BINARY . ' backup.php', ['--destination' => 'path/to/destination']);
$task
    ->identifier('backup')
    ->description('Copying the project directory');

return $schedule;

Usage:

Run schedule:run --task=backup

List crunz schedule:list


+---+------------+-----------------------+-------------+----------------+
| # | Identifier |            Task       | Expression  | Command to Run |
+---+------------+-----------------------+-------------+----------------+
| 1 |  backup    | Task description      | 0 * * * 1 * | scripts.php    |
+---+------------+-----------------------+-------------+----------------+

judgedim avatar Sep 09 '22 15:09 judgedim