mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
Use table output for list command
Signed-off-by: Lucas Azevedo <lhs_azevedo@hotmail.com>
This commit is contained in:
parent
2a36acfc2b
commit
9c66bf6dc3
1 changed files with 10 additions and 4 deletions
|
|
@ -61,18 +61,24 @@ class ListCommand extends Base {
|
|||
|
||||
$tokens = $this->tokenProvider->getTokenByUser($user->getUID());
|
||||
|
||||
$data = array_map(function (IToken $token): mixed {
|
||||
$filtered = [
|
||||
$tokens = array_map(function (IToken $token) use ($input): mixed {
|
||||
$sensitive = [
|
||||
'password',
|
||||
'password_hash',
|
||||
'token',
|
||||
'public_key',
|
||||
'private_key',
|
||||
];
|
||||
return array_diff_key($token->jsonSerialize(), array_flip($filtered));
|
||||
$data = array_diff_key($token->jsonSerialize(), array_flip($sensitive));
|
||||
|
||||
if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) {
|
||||
$data['scope'] = implode(', ', array_keys(array_filter($data['scope'])));
|
||||
}
|
||||
|
||||
return $data;
|
||||
}, $tokens);
|
||||
|
||||
$this->writeArrayInOutputFormat($input, $output, $data);
|
||||
$this->writeTableInOutputFormat($input, $output, $tokens);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue