Repository navigation
Expand file tree
/
Copy pathListTaskFieldsCommand.php
More file actions
42 lines (36 loc) · 1.73 KB
/
Copy pathListTaskFieldsCommand.php
File metadata and controls
42 lines (36 loc) · 1.73 KB
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
39
40
41
42
<?php
declare(strict_types=1);
namespace Bitrix24\CLI\Console\Command\Task;
use Bitrix24\CLI\Application\Task\TaskMetadataService;
use Bitrix24\CLI\Application\Task\Request\ListTaskFieldsRequest;
use Bitrix24\CLI\Console\CommandRunner;
use Bitrix24\CLI\Console\TaskInputMapper;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(name: 'task:fields:list', description: 'Показать поля задачи')]
final class ListTaskFieldsCommand extends Command
{
public function __construct(private readonly TaskMetadataService $service, private readonly TaskInputMapper $mapper, private readonly CommandRunner $runner)
{
parent::__construct();
}
protected function configure(): void
{
$this->addOption('name', null, InputOption::VALUE_REQUIRED, 'Имя поля метаданных.');
$this->setHelp('JSON: структура data/meta/error; столбцы TSV при --plain: name, type, editable, filterable, sortable. REST 3.0. Пример: b24cli task:fields:list --name title');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
return $this->runner->run(
$this,
$input,
$output,
fn (): ListTaskFieldsRequest => $this->mapper->listTaskFields($input),
fn (ListTaskFieldsRequest $request): array => $this->service->fieldsRoutes($request),
fn (ListTaskFieldsRequest $request): \Bitrix24\CLI\Application\PreparedOperation => $this->service->fields($request),
);
}
}