diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-11-23 12:29:20 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-11-23 12:29:20 +0100 |
commit | ff72eac9270d7e6840371f1ac38a60d66286079b (patch) | |
tree | 32f22d324124cff2fec8d728c90205bd52ac7e61 /apps/files_external/command | |
parent | 0795f7d71bdc5e7c1a444fd06cf76525e951850b (diff) | |
download | nextcloud-server-ff72eac9270d7e6840371f1ac38a60d66286079b.tar.gz nextcloud-server-ff72eac9270d7e6840371f1ac38a60d66286079b.zip |
truncate long values on default
Diffstat (limited to 'apps/files_external/command')
-rw-r--r-- | apps/files_external/command/listcommand.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/files_external/command/listcommand.php b/apps/files_external/command/listcommand.php index c10ca1efeb7..923939b4e34 100644 --- a/apps/files_external/command/listcommand.php +++ b/apps/files_external/command/listcommand.php @@ -77,6 +77,11 @@ class ListCommand extends Base { null, InputOption::VALUE_NONE, 'show passwords and secrets' + )->addOption( + 'full', + null, + InputOption::VALUE_NONE, + 'dont truncate long values in table output' ); parent::configure(); } @@ -154,16 +159,27 @@ class ListCommand extends Base { $output->writeln(json_encode(array_values($pairs), JSON_PRETTY_PRINT)); } } else { + $full = $input->getOption('full'); $defaultMountOptions = [ 'encrypt' => true, 'previews' => true, '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(); $keys = array_keys($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) { return $key . ': ' . json_encode($value); }, $keys, $values); |