Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/Command/CirclesCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -50,7 +53,7 @@
* @package OCA\Circles\Command
*/
class CirclesCreate extends Base {

use TDeserialize;

/** @var FederatedUserService */
private $federatedUserService;
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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: <info>' . $circle->getSingleId() . '</info>');
$output->writeln('Name: <info>' . $circle->getDisplayName() . '</info>');
$output->writeln('Owner: <info>' . $circle->getOwner()->getDisplayName() . '</info>');
}

return 0;
Expand Down