aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-21 00:47:45 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-09-29 15:57:10 +0200
commit5551c6311025e432525a75ecda4d99fbeec913a6 (patch)
treecf0d5fb8d6402364ea5add294e5dd7fb210ca16c
parent5cce64bfcc45b9b7be73f55bc78e22642c7ffaaf (diff)
downloadnextcloud-server-5551c6311025e432525a75ecda4d99fbeec913a6.tar.gz
nextcloud-server-5551c6311025e432525a75ecda4d99fbeec913a6.zip
Register the auto completion basic
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--core/Command/Base.php22
-rw-r--r--core/register_command.php1
2 files changed, 22 insertions, 1 deletions
diff --git a/core/Command/Base.php b/core/Command/Base.php
index 5fa4468f6eb..1a78e3b4062 100644
--- a/core/Command/Base.php
+++ b/core/Command/Base.php
@@ -23,12 +23,14 @@
namespace OC\Core\Command;
+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;
-class Base extends Command {
+class Base extends Command implements CompletionAwareInterface {
const OUTPUT_FORMAT_PLAIN = 'plain';
const OUTPUT_FORMAT_JSON = 'json';
const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty';
@@ -158,4 +160,22 @@ class Base extends Command {
return parent::run($input, $output);
}
+
+ /**
+ * @param string $optionName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeOptionValues($optionName, CompletionContext $context) {
+ return [];
+ }
+
+ /**
+ * @param string $argumentName
+ * @param CompletionContext $context
+ * @return string[]
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context) {
+ return [];
+ }
}
diff --git a/core/register_command.php b/core/register_command.php
index 6a220c22b3f..23621e54f8d 100644
--- a/core/register_command.php
+++ b/core/register_command.php
@@ -33,6 +33,7 @@
*/
/** @var $application Symfony\Component\Console\Application */
+$application->add(new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand());
$application->add(new OC\Core\Command\Status);
$application->add(new OC\Core\Command\Check(\OC::$server->getConfig()));
$infoParser = new \OC\App\InfoParser(\OC::$server->getURLGenerator());