truncate long values on default
This commit is contained in:
parent
0795f7d71b
commit
ff72eac927
|
@ -77,6 +77,11 @@ class ListCommand extends Base {
|
||||||
null,
|
null,
|
||||||
InputOption::VALUE_NONE,
|
InputOption::VALUE_NONE,
|
||||||
'show passwords and secrets'
|
'show passwords and secrets'
|
||||||
|
)->addOption(
|
||||||
|
'full',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_NONE,
|
||||||
|
'dont truncate long values in table output'
|
||||||
);
|
);
|
||||||
parent::configure();
|
parent::configure();
|
||||||
}
|
}
|
||||||
|
@ -154,16 +159,27 @@ class ListCommand extends Base {
|
||||||
$output->writeln(json_encode(array_values($pairs), JSON_PRETTY_PRINT));
|
$output->writeln(json_encode(array_values($pairs), JSON_PRETTY_PRINT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$full = $input->getOption('full');
|
||||||
$defaultMountOptions = [
|
$defaultMountOptions = [
|
||||||
'encrypt' => true,
|
'encrypt' => true,
|
||||||
'previews' => true,
|
'previews' => true,
|
||||||
'filesystem_check_changes' => 1
|
'filesystem_check_changes' => 1
|
||||||
];
|
];
|
||||||
$rows = array_map(function (StorageConfig $config) use ($userId, $defaultMountOptions) {
|
$rows = array_map(function (StorageConfig $config) use ($userId, $defaultMountOptions, $full) {
|
||||||
$storageConfig = $config->getBackendOptions();
|
$storageConfig = $config->getBackendOptions();
|
||||||
$keys = array_keys($storageConfig);
|
$keys = array_keys($storageConfig);
|
||||||
$values = array_values($storageConfig);
|
$values = array_values($storageConfig);
|
||||||
|
|
||||||
|
if (!$full) {
|
||||||
|
$values = array_map(function ($value) {
|
||||||
|
if (is_string($value) && strlen($value) > 32) {
|
||||||
|
return substr($value, 0, 6) . '...' . substr($value, -6, 6);
|
||||||
|
} else {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}, $values);
|
||||||
|
}
|
||||||
|
|
||||||
$configStrings = array_map(function ($key, $value) {
|
$configStrings = array_map(function ($key, $value) {
|
||||||
return $key . ': ' . json_encode($value);
|
return $key . ': ' . json_encode($value);
|
||||||
}, $keys, $values);
|
}, $keys, $values);
|
||||||
|
|
Loading…
Reference in New Issue