Skip to content

Commit 4dcde63

Browse files
committed
feat(command): added email:identity:list command
1 parent d4e5c27 commit 4dcde63

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of Ymir command-line tool.
7+
*
8+
* (c) Carl Alexander <[email protected]>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
namespace Ymir\Cli\Command\Email;
15+
16+
use Symfony\Component\Console\Input\InputInterface;
17+
use Ymir\Cli\Command\AbstractCommand;
18+
use Ymir\Cli\Console\OutputStyle;
19+
20+
class ListEmailIdentitiesCommand extends AbstractCommand
21+
{
22+
/**
23+
* The name of the command.
24+
*
25+
* @var string
26+
*/
27+
public const NAME = 'email:identity:list';
28+
29+
/**
30+
* {@inheritdoc}
31+
*/
32+
protected function configure()
33+
{
34+
$this
35+
->setName(self::NAME)
36+
->setDescription('List the email identities that belong to the currently active team');
37+
}
38+
39+
/**
40+
* {@inheritdoc}
41+
*/
42+
protected function perform(InputInterface $input, OutputStyle $output)
43+
{
44+
$identities = $this->apiClient->getEmailIdentities($this->cliConfiguration->getActiveTeamId());
45+
46+
$output->table(
47+
['Id', 'Name', 'Type', 'Provider', 'Region', 'Status', 'Managed'],
48+
$identities->map(function (array $identity) {
49+
return [$identity['id'], $identity['name'], $identity['type'], $identity['provider']['name'], $identity['region'], $identity['status'], $identity['managed'] ? 'yes' : 'no'];
50+
})->all()
51+
);
52+
}
53+
}

0 commit comments

Comments
 (0)