From c7acab5bf73dc96b883c1e9d7bd736769185fb84 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Wed, 30 Oct 2024 15:09:25 +0200 Subject: [PATCH] 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 --- core/Command/Group/ListCommand.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/Command/Group/ListCommand.php b/core/Command/Group/ListCommand.php index 13161ec0eaaf2..5f216a02e1c40 100644 --- a/core/Command/Group/ListCommand.php +++ b/core/Command/Group/ListCommand.php @@ -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; @@ -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', @@ -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; }