aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/L10n
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-21 14:39:32 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-09-29 15:57:10 +0200
commit114eb6ba321bf50e984f7a86073c8ebefb12d1f8 (patch)
tree446af3fc0efb6f9a949a6f64b6d14301ed789f33 /core/Command/L10n
parent8906b1cc95cfb729fcedeb40402d4e8855139096 (diff)
downloadnextcloud-server-114eb6ba321bf50e984f7a86073c8ebefb12d1f8.tar.gz
nextcloud-server-114eb6ba321bf50e984f7a86073c8ebefb12d1f8.zip
Autocomplete for l10n:* and twofactorauth:*
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command/L10n')
-rw-r--r--core/Command/L10n/CreateJs.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/core/Command/L10n/CreateJs.php b/core/Command/L10n/CreateJs.php
index 53e897e6b43..e52f588b831 100644
--- a/core/Command/L10n/CreateJs.php
+++ b/core/Command/L10n/CreateJs.php
@@ -25,13 +25,15 @@ namespace OC\Core\Command\L10n;
use DirectoryIterator;
+use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use UnexpectedValueException;
-class CreateJs extends Command {
+class CreateJs extends Command implements CompletionAwareInterface {
protected function configure() {
$this
@@ -135,4 +137,32 @@ class CreateJs extends Command {
return array($TRANSLATIONS, $PLURAL_FORMS);
}
+
+ /**
+ * Return possible values for the named option
+ *
+ * @param string $optionName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeOptionValues($optionName, CompletionContext $context) {
+ return [];
+ }
+
+ /**
+ * Return possible values for the named argument
+ *
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ if ($argumentName === 'app') {
+ return \OC_App::getAllApps();
+ } else if ($argumentName === 'lang') {
+ $appName = $context->getWordAtIndex($context->getWordIndex() - 1);
+ return $this->getAllLanguages(\OC_App::getAppPath($appName));
+ }
+ return [];
+ }
}