Add --json to polls list and polls show
Machine-readable output for scripts; never contains the admin token unless --link is given. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
664088e139
commit
3d6ade668f
6 files changed
+115
-2
No files matched your search
@@ -37,6 +37,10 @@ class PollsListCommand extends PollsCommand
|
||||
->addOption('email', [
|
||||
'help' => __('Nur Umfragen, deren E-Mail-Adresse diesen Text enthält.'),
|
||||
])
|
||||
->addOption('json', [
|
||||
'help' => __('Ausgabe als JSON statt als Tabelle (für Skripte).'),
|
||||
'boolean' => true,
|
||||
])
|
||||
->addOption('sort', [
|
||||
'help' => __('Sortierung (aufsteigend).'),
|
||||
'default' => 'created',
|
||||
@@ -75,6 +79,12 @@ class PollsListCommand extends PollsCommand
|
||||
});
|
||||
}
|
||||
|
||||
if ($args->getOption('json')) {
|
||||
$this->printJson($io, array_map($this->pollData(...), $polls));
|
||||
|
||||
return static::CODE_SUCCESS;
|
||||
}
|
||||
|
||||
if ($polls === []) {
|
||||
$io->out(__('Keine Umfragen gefunden.'));
|
||||
|
||||
|
||||
Reference in new issue
Block a user