mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
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 <es.rosenberg+github@gmail.com>
This commit is contained in:
parent
d69f2bcb12
commit
c7acab5bf7
1 changed files with 8 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ namespace OC\Core\Command\Group;
|
|||
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;
|
||||
|
|
@ -23,6 +24,12 @@ class ListCommand extends Base {
|
|||
$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',
|
||||
|
|
@ -50,7 +57,7 @@ class ListCommand extends Base {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue