Skip to content

Commit 3b2b9e8

Browse files
Merge pull request #1057 from nextcloud/backport/1012/stable23
[stable23] [occ] display information about freshly created circle
2 parents dac4adf + cfae6f0 commit 3b2b9e8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/Command/CirclesCreate.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@
3636
use OCA\Circles\Exceptions\InitiatorNotFoundException;
3737
use OCA\Circles\Exceptions\RequestBuilderException;
3838
use OCA\Circles\Exceptions\SingleCircleNotFoundException;
39+
use OCA\Circles\Model\Circle;
3940
use OCA\Circles\Model\Member;
4041
use OCA\Circles\Service\CircleService;
4142
use OCA\Circles\Service\FederatedUserService;
43+
use OCA\Circles\Tools\Exceptions\InvalidItemException;
44+
use OCA\Circles\Tools\Traits\TDeserialize;
4245
use Symfony\Component\Console\Input\InputArgument;
4346
use Symfony\Component\Console\Input\InputInterface;
4447
use Symfony\Component\Console\Input\InputOption;
@@ -50,7 +53,7 @@
5053
* @package OCA\Circles\Command
5154
*/
5255
class CirclesCreate extends Base {
53-
56+
use TDeserialize;
5457

5558
/** @var FederatedUserService */
5659
private $federatedUserService;
@@ -100,6 +103,7 @@ protected function configure() {
100103
* @throws InitiatorNotFoundException
101104
* @throws SingleCircleNotFoundException
102105
* @throws RequestBuilderException
106+
* @throws InvalidItemException
103107
*/
104108
protected function execute(InputInterface $input, OutputInterface $output): int {
105109
$ownerId = $input->getArgument('owner');
@@ -129,6 +133,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
129133

130134
if (strtolower($input->getOption('output')) === 'json') {
131135
$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>');
132142
}
133143

134144
return 0;

0 commit comments

Comments
 (0)