diff options
Diffstat (limited to 'core/Command/User/Setting.php')
-rw-r--r-- | core/Command/User/Setting.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index 87fb6905de9..3e4830127cd 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -29,6 +29,7 @@ use OC\Core\Command\Base; use OCP\IConfig; use OCP\IUser; use OCP\IUserManager; +use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -255,4 +256,27 @@ class Setting extends Base { return $settings; } + + /** + * @param string $argumentName + * @param CompletionContext $context + * @return string[] + */ + public function completeArgumentValues($argumentName, CompletionContext $context) { + if ($argumentName === 'uid') { + return array_map(static fn (IUser $user) => $user->getUID(), $this->userManager->search($context->getCurrentWord())); + } + if ($argumentName === 'app') { + $userId = $context->getWordAtIndex($context->getWordIndex() - 1); + $settings = $this->getUserSettings($userId, ''); + return array_keys($settings); + } + if ($argumentName === 'key') { + $userId = $context->getWordAtIndex($context->getWordIndex() - 2); + $app = $context->getWordAtIndex($context->getWordIndex() - 1); + $settings = $this->getUserSettings($userId, $app); + return array_keys($settings[$app]); + } + return []; + } } |