diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/Config/Import.php | 2 | ||||
-rw-r--r-- | core/Command/Db/ConvertType.php | 29 | ||||
-rw-r--r-- | core/Command/Db/GenerateChangeScript.php | 32 | ||||
-rw-r--r-- | core/Command/Log/File.php | 33 | ||||
-rw-r--r-- | core/Command/Log/Manage.php | 33 |
5 files changed, 120 insertions, 9 deletions
diff --git a/core/Command/Config/Import.php b/core/Command/Config/Import.php index 15517f860a5..4a8db1c9656 100644 --- a/core/Command/Config/Import.php +++ b/core/Command/Config/Import.php @@ -201,7 +201,7 @@ class Import extends Command implements CompletionAwareInterface { /** * @param string $optionName * @param CompletionContext $context - * @return string[]|false + * @return string[] */ public function completeOptionValues($optionName, CompletionContext $context) { return []; diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index f8367f75867..a8969251bab 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -31,6 +31,8 @@ namespace OC\Core\Command\Db; use \OCP\IConfig; use OC\DB\Connection; use OC\DB\ConnectionFactory; +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\Helper\ProgressBar; use Symfony\Component\Console\Helper\QuestionHelper; @@ -41,7 +43,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; -class ConvertType extends Command { +class ConvertType extends Command implements CompletionAwareInterface { /** * @var \OCP\IConfig */ @@ -350,4 +352,29 @@ class ConvertType extends Command { 'dbpassword' => $password, ]); } + + /** + * 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 === 'type') { + return ['mysql', 'oci', 'pgsql']; + } + return []; + } } diff --git a/core/Command/Db/GenerateChangeScript.php b/core/Command/Db/GenerateChangeScript.php index 9ef4d57967a..bbe8d29958e 100644 --- a/core/Command/Db/GenerateChangeScript.php +++ b/core/Command/Db/GenerateChangeScript.php @@ -23,12 +23,16 @@ namespace OC\Core\Command\Db; +use Stecman\Component\Symfony\Console\BashCompletion\Completion; +use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface; +use Stecman\Component\Symfony\Console\BashCompletion\Completion\ShellPathCompletion; +use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class GenerateChangeScript extends Command { +class GenerateChangeScript extends Command implements CompletionAwareInterface { protected function configure() { $this ->setName('db:generate-change-script') @@ -56,4 +60,30 @@ class GenerateChangeScript extends Command { } } + + /** + * @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) { + if ($argumentName === 'schema-xml') { + $helper = new ShellPathCompletion( + $this->getName(), + 'schema-xml', + Completion::TYPE_ARGUMENT + ); + return $helper->run(); + } + return []; + } } diff --git a/core/Command/Log/File.php b/core/Command/Log/File.php index ec490237400..d53484f086d 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -25,13 +25,15 @@ namespace OC\Core\Command\Log; use \OCP\IConfig; +use Stecman\Component\Symfony\Console\BashCompletion\Completion; +use Stecman\Component\Symfony\Console\BashCompletion\Completion\ShellPathCompletion; +use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class File extends Command { +class File extends Command implements Completion\CompletionAwareInterface { /** @var IConfig */ protected $config; @@ -125,4 +127,31 @@ class File extends Command { } } + /** + * @param string $optionName + * @param CompletionContext $context + * @return string[] + */ + public function completeOptionValues($optionName, CompletionContext $context) { + if ($optionName === 'file') { + $helper = new ShellPathCompletion( + $this->getName(), + 'file', + Completion::TYPE_OPTION + ); + return $helper->run(); + } else if ($optionName === 'rotate-size') { + return [0]; + } + return []; + } + + /** + * @param string $argumentName + * @param CompletionContext $context + * @return string[] + */ + public function completeArgumentValues($argumentName, CompletionContext $context) { + return []; + } } diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php index 554708dfa42..578e8e8dac6 100644 --- a/core/Command/Log/Manage.php +++ b/core/Command/Log/Manage.php @@ -24,15 +24,15 @@ namespace OC\Core\Command\Log; -use \OCP\IConfig; - +use OCP\IConfig; +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\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class Manage extends Command { +class Manage extends Command implements CompletionAwareInterface { const DEFAULT_BACKEND = 'file'; const DEFAULT_LOG_LEVEL = 2; @@ -172,4 +172,29 @@ class Manage extends Command { } throw new \InvalidArgumentException('Invalid log level number'); } + + /** + * @param string $optionName + * @param CompletionContext $context + * @return string[] + */ + public function completeOptionValues($optionName, CompletionContext $context) { + if ($optionName === 'backend') { + return ['file', 'syslog', 'errorlog']; + } else if ($optionName === 'level') { + return ['debug', 'info', 'warning', 'error']; + } else if ($optionName === 'timezone') { + return \DateTimeZone::listIdentifiers(); + } + return []; + } + + /** + * @param string $argumentName + * @param CompletionContext $context + * @return string[] + */ + public function completeArgumentValues($argumentName, CompletionContext $context) { + return []; + } } |