Implement group:show command
This commit is contained in:
parent
680daec300
commit
8c5e962a55
4
composer.lock
generated
4
composer.lock
generated
@ -594,7 +594,7 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "../slotdb-client-php",
|
||||
"reference": "f3d6e3e7b3a8daa3111e27407f13ba8c56bf997f"
|
||||
"reference": "bee9457d9da382621e3cc99ffd4b75af443ad27b"
|
||||
},
|
||||
"require": {
|
||||
"psr/http-client": "^1.0"
|
||||
@ -620,7 +620,7 @@
|
||||
}
|
||||
],
|
||||
"description": "SlotDB PHP Client",
|
||||
"time": "2025-03-13T18:11:29+00:00"
|
||||
"time": "2025-03-13T23:31:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
|
@ -22,15 +22,27 @@ class GroupShowCommand extends Command
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
|
||||
$this->addArgument("group", InputArgument::REQUIRED, "Group to display");
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$groupId = $input->getArgument("group");
|
||||
|
||||
$group = $this->client->queryGroup($groupId);
|
||||
|
||||
$groups = $this->client->findGroups();
|
||||
$len = 2 + max(array_map(mb_strlen(...), array_keys($group)));
|
||||
|
||||
var_dump($groups);
|
||||
foreach ($group as $k=>$v) {
|
||||
$output->writeln(
|
||||
sprintf(
|
||||
str_starts_with($k,"_")
|
||||
? "<fg=green>%{$len}s</>: <fg=gray>%s</>"
|
||||
: "<fg=green;options=bold>%{$len}s</>: <fg=yellow>%s</>",
|
||||
$k, json_encode($v)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user