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 1/2] 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; } From 5e97a46f4c141c950bc2c73e2cd5a2f0825e451c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <91878298+come-nc@users.noreply.github.com> Date: Mon, 3 Feb 2025 11:07:41 +0100 Subject: [PATCH 2/2] fix: Clearly document that the argument is a search string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not an exact match on the group id Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> --- core/Command/Group/ListCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/Command/Group/ListCommand.php b/core/Command/Group/ListCommand.php index 5f216a02e1c40..a3622585d1815 100644 --- a/core/Command/Group/ListCommand.php +++ b/core/Command/Group/ListCommand.php @@ -25,9 +25,9 @@ protected function configure() { ->setName('group:list') ->setDescription('list configured groups') ->addArgument( - 'groupid', + 'searchstring', InputArgument::OPTIONAL, - 'Group id to show only the members of that group', + 'Filter the groups to only those matching the search string', '' ) ->addOption( @@ -57,7 +57,7 @@ protected function configure() { } protected function execute(InputInterface $input, OutputInterface $output): int { - $groups = $this->groupManager->search((string)$input->getArgument('groupid'), (int)$input->getOption('limit'), (int)$input->getOption('offset')); + $groups = $this->groupManager->search((string)$input->getArgument('searchstring'), (int)$input->getOption('limit'), (int)$input->getOption('offset')); $this->writeArrayInOutputFormat($input, $output, $this->formatGroups($groups, (bool)$input->getOption('info'))); return 0; }