|
36 | 36 | use OCA\Circles\Exceptions\InitiatorNotFoundException; |
37 | 37 | use OCA\Circles\Exceptions\RequestBuilderException; |
38 | 38 | use OCA\Circles\Exceptions\SingleCircleNotFoundException; |
| 39 | +use OCA\Circles\Model\Circle; |
39 | 40 | use OCA\Circles\Model\Member; |
40 | 41 | use OCA\Circles\Service\CircleService; |
41 | 42 | use OCA\Circles\Service\FederatedUserService; |
| 43 | +use OCA\Circles\Tools\Exceptions\InvalidItemException; |
| 44 | +use OCA\Circles\Tools\Traits\TDeserialize; |
42 | 45 | use Symfony\Component\Console\Input\InputArgument; |
43 | 46 | use Symfony\Component\Console\Input\InputInterface; |
44 | 47 | use Symfony\Component\Console\Input\InputOption; |
|
50 | 53 | * @package OCA\Circles\Command |
51 | 54 | */ |
52 | 55 | class CirclesCreate extends Base { |
53 | | - |
| 56 | + use TDeserialize; |
54 | 57 |
|
55 | 58 | /** @var FederatedUserService */ |
56 | 59 | private $federatedUserService; |
@@ -100,6 +103,7 @@ protected function configure() { |
100 | 103 | * @throws InitiatorNotFoundException |
101 | 104 | * @throws SingleCircleNotFoundException |
102 | 105 | * @throws RequestBuilderException |
| 106 | + * @throws InvalidItemException |
103 | 107 | */ |
104 | 108 | protected function execute(InputInterface $input, OutputInterface $output): int { |
105 | 109 | $ownerId = $input->getArgument('owner'); |
@@ -129,6 +133,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
129 | 133 |
|
130 | 134 | if (strtolower($input->getOption('output')) === 'json') { |
131 | 135 | $output->writeln(json_encode($outcome, JSON_PRETTY_PRINT)); |
| 136 | + } elseif (strtolower($input->getOption('output')) !== 'none') { |
| 137 | + /** @var Circle $circle */ |
| 138 | + $circle = $this->deserialize($outcome, Circle::class); |
| 139 | + $output->writeln('Id: <info>' . $circle->getSingleId() . '</info>'); |
| 140 | + $output->writeln('Name: <info>' . $circle->getDisplayName() . '</info>'); |
| 141 | + $output->writeln('Owner: <info>' . $circle->getOwner()->getDisplayName() . '</info>'); |
132 | 142 | } |
133 | 143 |
|
134 | 144 | return 0; |
|
0 commit comments