-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathGenerateTaskCommand.php
More file actions
38 lines (31 loc) · 799 Bytes
/
GenerateTaskCommand.php
File metadata and controls
38 lines (31 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Bow\Console\Command\Generator;
use Bow\Console\AbstractCommand;
use Bow\Console\Color;
use Bow\Console\Generator;
class GenerateTaskCommand extends AbstractCommand
{
/**
* Add task
*
* @param string $task
* @return void
*/
public function run(string $task): void
{
$generator = new Generator(
$this->setting->getTaskDirectory(),
$task
);
if ($generator->fileExists()) {
echo Color::red("The task already exists");
exit(1);
}
$generator->write('task', [
'baseNamespace' => $this->namespaces['task'] ?? 'App\\Tasks'
]);
echo Color::green("The task has been well created.");
exit(0);
}
}