Skip to content

Commit

Permalink
Add the option to provide a groupname and only see its' members.
Browse files Browse the repository at this point in the history
Improvements/TODO:
1. Fail/return error if group doesn't exist
2. Only print the members and not the groupname

Signed-off-by: E.S. Rosenberg a.k.a. Keeper of the Keys <[email protected]>
  • Loading branch information
Keeper-of-the-Keys committed Oct 30, 2024
1 parent 399b048 commit 7b82a6a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/Command/Group/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use OC\Core\Command\Base;
use OCP\IGroup;
use OCP\IGroupManager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -23,6 +24,12 @@ protected function configure() {
$this
->setName('group:list')
->setDescription('list configured groups')
->addArgument(
'groupid',
InputArgument::OPTIONAL,
'Group id to show only the members of that group',
''
)
->addOption(
'limit',
'l',
Expand Down Expand Up @@ -50,7 +57,7 @@ protected function configure() {
}

protected function execute(InputInterface $input, OutputInterface $output): int {
$groups = $this->groupManager->search('', (int)$input->getOption('limit'), (int)$input->getOption('offset'));
$groups = $this->groupManager->search((string)$input->getArgument('groupid'), (int)$input->getOption('limit'), (int)$input->getOption('offset'));
$this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups, (bool)$input->getOption('info')));
return 0;
}
Expand Down

0 comments on commit 7b82a6a

Please sign in to comment.