diff --git a/lib/Command/CirclesCreate.php b/lib/Command/CirclesCreate.php index bcba99c94..0e2cc2af1 100644 --- a/lib/Command/CirclesCreate.php +++ b/lib/Command/CirclesCreate.php @@ -36,9 +36,12 @@ use OCA\Circles\Exceptions\InitiatorNotFoundException; use OCA\Circles\Exceptions\RequestBuilderException; use OCA\Circles\Exceptions\SingleCircleNotFoundException; +use OCA\Circles\Model\Circle; use OCA\Circles\Model\Member; use OCA\Circles\Service\CircleService; use OCA\Circles\Service\FederatedUserService; +use OCA\Circles\Tools\Exceptions\InvalidItemException; +use OCA\Circles\Tools\Traits\TDeserialize; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -50,7 +53,7 @@ * @package OCA\Circles\Command */ class CirclesCreate extends Base { - + use TDeserialize; /** @var FederatedUserService */ private $federatedUserService; @@ -100,6 +103,7 @@ protected function configure() { * @throws InitiatorNotFoundException * @throws SingleCircleNotFoundException * @throws RequestBuilderException + * @throws InvalidItemException */ protected function execute(InputInterface $input, OutputInterface $output): int { $ownerId = $input->getArgument('owner'); @@ -129,6 +133,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (strtolower($input->getOption('output')) === 'json') { $output->writeln(json_encode($outcome, JSON_PRETTY_PRINT)); + } elseif (strtolower($input->getOption('output')) !== 'none') { + /** @var Circle $circle */ + $circle = $this->deserialize($outcome, Circle::class); + $output->writeln('Id: ' . $circle->getSingleId() . ''); + $output->writeln('Name: ' . $circle->getDisplayName() . ''); + $output->writeln('Owner: ' . $circle->getOwner()->getDisplayName() . ''); } return 0;