Full support for autocomplete of app:*
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
5551c63110
commit
e1df6b5702
|
@ -29,13 +29,15 @@ use OC\App\CodeChecker\CodeChecker;
|
||||||
use OC\App\CodeChecker\EmptyCheck;
|
use OC\App\CodeChecker\EmptyCheck;
|
||||||
use OC\App\CodeChecker\InfoChecker;
|
use OC\App\CodeChecker\InfoChecker;
|
||||||
use OC\App\InfoParser;
|
use OC\App\InfoParser;
|
||||||
|
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\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class CheckCode extends Command {
|
class CheckCode extends Command implements CompletionAwareInterface {
|
||||||
|
|
||||||
/** @var InfoParser */
|
/** @var InfoParser */
|
||||||
private $infoParser;
|
private $infoParser;
|
||||||
|
@ -197,4 +199,28 @@ class CheckCode extends Command {
|
||||||
$output->writeln("<info>Deprecated file found: $updatePhp - please use repair steps</info>");
|
$output->writeln("<info>Deprecated file found: $updatePhp - please use repair steps</info>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $optionName
|
||||||
|
* @param CompletionContext $context
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function completeOptionValues($optionName, CompletionContext $context) {
|
||||||
|
if ($optionName === 'checker') {
|
||||||
|
return ['private', 'deprecation', 'strong-comparison'];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $argumentName
|
||||||
|
* @param CompletionContext $context
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function completeArgumentValues($argumentName, CompletionContext $context) {
|
||||||
|
if ($argumentName === 'app-id') {
|
||||||
|
return \OC_App::getAllApps();
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,14 @@
|
||||||
namespace OC\Core\Command\App;
|
namespace OC\Core\Command\App;
|
||||||
|
|
||||||
use OCP\App\IAppManager;
|
use OCP\App\IAppManager;
|
||||||
|
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\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class Disable extends Command {
|
class Disable extends Command implements CompletionAwareInterface {
|
||||||
|
|
||||||
/** @var IAppManager */
|
/** @var IAppManager */
|
||||||
protected $manager;
|
protected $manager;
|
||||||
|
@ -69,4 +71,25 @@ class Disable extends Command {
|
||||||
$output->writeln('No such app enabled: ' . $appId);
|
$output->writeln('No such app enabled: ' . $appId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 === 'app-id') {
|
||||||
|
return array_diff(\OC_App::getEnabledApps(true, true), $this->manager->getAlwaysEnabledApps());
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,16 @@
|
||||||
namespace OC\Core\Command\App;
|
namespace OC\Core\Command\App;
|
||||||
|
|
||||||
use OCP\App\IAppManager;
|
use OCP\App\IAppManager;
|
||||||
|
use OCP\IGroup;
|
||||||
|
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\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class Enable extends Command {
|
class Enable extends Command implements CompletionAwareInterface {
|
||||||
|
|
||||||
/** @var IAppManager */
|
/** @var IAppManager */
|
||||||
protected $manager;
|
protected $manager;
|
||||||
|
@ -81,4 +84,31 @@ class Enable extends Command {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $optionName
|
||||||
|
* @param CompletionContext $context
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function completeOptionValues($optionName, CompletionContext $context) {
|
||||||
|
if ($optionName === 'groups') {
|
||||||
|
return array_map(function(IGroup $group) {
|
||||||
|
return $group->getGID();
|
||||||
|
}, \OC::$server->getGroupManager()->search($context->getCurrentWord()));
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $argumentName
|
||||||
|
* @param CompletionContext $context
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function completeArgumentValues($argumentName, CompletionContext $context) {
|
||||||
|
if ($argumentName === 'app-id') {
|
||||||
|
$allApps = \OC_App::getAllApps();
|
||||||
|
return array_diff($allApps, \OC_App::getEnabledApps(true, true));
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
namespace OC\Core\Command\App;
|
namespace OC\Core\Command\App;
|
||||||
|
|
||||||
use OC\Core\Command\Base;
|
use OC\Core\Command\Base;
|
||||||
|
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
@ -60,4 +61,16 @@ class GetPath extends Base {
|
||||||
// App not found, exit with non-zero
|
// App not found, exit with non-zero
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $argumentName
|
||||||
|
* @param CompletionContext $context
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function completeArgumentValues($argumentName, CompletionContext $context) {
|
||||||
|
if ($argumentName === 'app') {
|
||||||
|
return \OC_App::getAllApps();
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace OC\Core\Command\App;
|
||||||
|
|
||||||
use OC\Core\Command\Base;
|
use OC\Core\Command\Base;
|
||||||
use OCP\App\IAppManager;
|
use OCP\App\IAppManager;
|
||||||
|
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
@ -117,4 +118,25 @@ class ListApps extends Base {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $optionName
|
||||||
|
* @param CompletionContext $completionContext
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function completeOptionValues($optionName, CompletionContext $completionContext) {
|
||||||
|
if ($optionName === 'shipped') {
|
||||||
|
return ['true', 'false'];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $argumentName
|
||||||
|
* @param CompletionContext $context
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function completeArgumentValues($argumentName, CompletionContext $context) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue