Skip to content

Commit 7b82a6a

Browse files
Add the option to provide a groupname and only see its' members.
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]>
1 parent 399b048 commit 7b82a6a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/Command/Group/ListCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use OC\Core\Command\Base;
99
use OCP\IGroup;
1010
use OCP\IGroupManager;
11+
use Symfony\Component\Console\Input\InputArgument;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Input\InputOption;
1314
use Symfony\Component\Console\Output\OutputInterface;
@@ -23,6 +24,12 @@ protected function configure() {
2324
$this
2425
->setName('group:list')
2526
->setDescription('list configured groups')
27+
->addArgument(
28+
'groupid',
29+
InputArgument::OPTIONAL,
30+
'Group id to show only the members of that group',
31+
''
32+
)
2633
->addOption(
2734
'limit',
2835
'l',
@@ -50,7 +57,7 @@ protected function configure() {
5057
}
5158

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

0 commit comments

Comments
 (0)