Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable23] [occ] display information about freshly created circle #1057

Merged
merged 1 commit into from
Jun 13, 2022
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