You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Base.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Core\Command\TwoFactorAuth;
  7. use OCP\IUser;
  8. use OCP\IUserManager;
  9. use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
  10. class Base extends \OC\Core\Command\Base {
  11. public function __construct(
  12. ?string $name,
  13. protected IUserManager $userManager,
  14. ) {
  15. parent::__construct($name);
  16. }
  17. /**
  18. * Return possible values for the named option
  19. *
  20. * @param string $optionName
  21. * @param CompletionContext $context
  22. * @return string[]
  23. */
  24. public function completeOptionValues($optionName, CompletionContext $context) {
  25. return [];
  26. }
  27. /**
  28. * Return possible values for the named argument
  29. *
  30. * @param string $argumentName
  31. * @param CompletionContext $context
  32. * @return string[]
  33. */
  34. public function completeArgumentValues($argumentName, CompletionContext $context) {
  35. if ($argumentName === 'uid') {
  36. return array_map(function (IUser $user) {
  37. return $user->getUID();
  38. }, $this->userManager->search($context->getCurrentWord(), 100));
  39. }
  40. return [];
  41. }
  42. }