From cc5c711d32fc86f17624b7afa115af5d1034e888 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Fri, 14 Mar 2025 22:57:35 +0100 Subject: [PATCH] Fix the group:find command --- src/Command/Group/GroupFindCommand.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Command/Group/GroupFindCommand.php b/src/Command/Group/GroupFindCommand.php index 38158eb..92d3120 100644 --- a/src/Command/Group/GroupFindCommand.php +++ b/src/Command/Group/GroupFindCommand.php @@ -30,7 +30,24 @@ class GroupFindCommand extends Command $groups = $this->client->findGroups(); - var_dump($groups); + $keys = []; + foreach ($groups as $group) { + $keys = array_merge($keys, array_keys($group)); + } + $keys = array_unique($keys); + + $table = new Table($output); + $table->setHeaders($keys); + $table->setStyle('box'); + foreach ($groups as $group) { + $row = []; + foreach ($keys as $key) { + $row[] = isset($group[$key]) ? json_encode($group[$key]) : null; + } + $table->addRow($row); + } + + $table->render(); return self::SUCCESS; }