Base.php 774 B

123456789101112131415161718192021222324252627282930
  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\Config\App;
  7. use OCP\IConfig;
  8. use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
  9. abstract class Base extends \OC\Core\Command\Base {
  10. protected IConfig $config;
  11. /**
  12. * @param string $argumentName
  13. * @param CompletionContext $context
  14. * @return string[]
  15. */
  16. public function completeArgumentValues($argumentName, CompletionContext $context) {
  17. if ($argumentName === 'app') {
  18. return \OC_App::getAllApps();
  19. }
  20. if ($argumentName === 'name') {
  21. $appName = $context->getWordAtIndex($context->getWordIndex() - 1);
  22. return $this->config->getAppKeys($appName);
  23. }
  24. return [];
  25. }
  26. }