Page MenuHomeIn-Portal Phabricator

D138.id317.diff
No OneTemporary

File Metadata

Created
Sat, Jun 28, 8:49 PM

D138.id317.diff

Index: core/install/cache/class_structure.php
===================================================================
--- core/install/cache/class_structure.php
+++ core/install/cache/class_structure.php
@@ -845,6 +845,7 @@
'extends' => array(
0 => 'Symfony\\Component\\Console\\Command\\Command',
1 => 'InPortal\\Core\\kernel\\Console\\Command\\IConsoleCommand',
+ 2 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\Command\\BuildClassMapCommand' => array(
@@ -852,7 +853,6 @@
'modifiers' => 0,
'extends' => array(
0 => 'InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
- 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\Command\\CompletionCommand' => array(
@@ -878,7 +878,6 @@
'modifiers' => 0,
'extends' => array(
0 => 'InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
- 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\Command\\RunScheduledTaskCommand' => array(
@@ -886,7 +885,6 @@
'modifiers' => 0,
'extends' => array(
0 => 'InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
- 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\ConsoleApplication' => array(
Index: core/kernel/Console/Command/AbstractCommand.php
===================================================================
--- core/kernel/Console/Command/AbstractCommand.php
+++ core/kernel/Console/Command/AbstractCommand.php
@@ -16,13 +16,15 @@
use InPortal\Core\kernel\Console\ConsoleApplication;
+use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
defined('FULL_PATH') or die('restricted access!');
-abstract class AbstractCommand extends SymfonyCommand implements IConsoleCommand
+abstract class AbstractCommand extends SymfonyCommand implements IConsoleCommand, CompletionAwareInterface
{
/**
@@ -58,6 +60,36 @@
}
/**
+ * Return possible values for the named option
+ *
+ * @param string $optionName Option name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeOptionValues($optionName, CompletionContext $context)
+ {
+ $this->initDependencies();
+
+ return array();
+ }
+
+ /**
+ * Return possible values for the named argument
+ *
+ * @param string $argumentName Argument name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context)
+ {
+ $this->initDependencies();
+
+ return array();
+ }
+
+ /**
* Perform additional validation of the input.
*
* @param InputInterface $input An InputInterface instance.
@@ -74,6 +106,18 @@
if ( count($arguments) < $this->getDefinition()->getArgumentRequiredCount() ) {
throw new \RuntimeException('Not enough arguments.');
}
+
+ $this->initDependencies();
+ }
+
+ /**
+ * Initializes dependencies.
+ *
+ * @return void
+ */
+ protected function initDependencies()
+ {
+
}
}
Index: core/kernel/Console/Command/BuildClassMapCommand.php
===================================================================
--- core/kernel/Console/Command/BuildClassMapCommand.php
+++ core/kernel/Console/Command/BuildClassMapCommand.php
@@ -16,7 +16,6 @@
use InPortal\Core\kernel\utility\ClassDiscovery\ClassMapBuilder;
-use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -24,7 +23,7 @@
defined('FULL_PATH') or die('restricted access!');
-class BuildClassMapCommand extends AbstractCommand implements CompletionAwareInterface
+class BuildClassMapCommand extends AbstractCommand
{
/**
@@ -101,11 +100,13 @@
*/
public function completeOptionValues($optionName, CompletionContext $context)
{
+ $suggestions = parent::completeOptionValues($optionName, $context);
+
if ( $optionName === 'module' ) {
return $this->getModules();
}
- return array();
+ return $suggestions;
}
/**
@@ -120,17 +121,4 @@
return array_diff($modules, array('In-Portal'));
}
- /**
- * Return possible values for the named argument.
- *
- * @param string $argumentName Argument name.
- * @param CompletionContext $context Completion context.
- *
- * @return array
- */
- public function completeArgumentValues($argumentName, CompletionContext $context)
- {
- return array();
- }
-
}
Index: core/kernel/Console/Command/RunEventCommand.php
===================================================================
--- core/kernel/Console/Command/RunEventCommand.php
+++ core/kernel/Console/Command/RunEventCommand.php
@@ -15,7 +15,6 @@
namespace InPortal\Core\kernel\Console\Command;
-use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -23,7 +22,7 @@
defined('FULL_PATH') or die('restricted access!');
-class RunEventCommand extends AbstractCommand implements CompletionAwareInterface
+class RunEventCommand extends AbstractCommand
{
/**
@@ -62,19 +61,6 @@
}
/**
- * Return possible values for the named option
- *
- * @param string $optionName Option name.
- * @param CompletionContext $context Completion context.
- *
- * @return array
- */
- public function completeOptionValues($optionName, CompletionContext $context)
- {
- return array();
- }
-
- /**
* Return possible values for the named argument.
*
* @param string $argumentName Argument name.
@@ -84,6 +70,8 @@
*/
public function completeArgumentValues($argumentName, CompletionContext $context)
{
+ $suggestions = parent::completeArgumentValues($argumentName, $context);
+
if ( $argumentName === 'event_name' ) {
$event_name = $context->getCurrentWord();
@@ -120,7 +108,7 @@
return $suggestions;
}
- return array();
+ return $suggestions;
}
}
Index: core/kernel/Console/Command/RunScheduledTaskCommand.php
===================================================================
--- core/kernel/Console/Command/RunScheduledTaskCommand.php
+++ core/kernel/Console/Command/RunScheduledTaskCommand.php
@@ -15,7 +15,6 @@
namespace InPortal\Core\kernel\Console\Command;
-use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -23,7 +22,7 @@
defined('FULL_PATH') or die('restricted access!');
-class RunScheduledTaskCommand extends AbstractCommand implements CompletionAwareInterface
+class RunScheduledTaskCommand extends AbstractCommand
{
/**
@@ -72,19 +71,6 @@
}
/**
- * Return possible values for the named option
- *
- * @param string $optionName Option name.
- * @param CompletionContext $context Completion context.
- *
- * @return array
- */
- public function completeOptionValues($optionName, CompletionContext $context)
- {
- return array();
- }
-
- /**
* Return possible values for the named argument.
*
* @param string $argumentName Argument name.
@@ -94,11 +80,13 @@
*/
public function completeArgumentValues($argumentName, CompletionContext $context)
{
+ $suggestions = parent::completeArgumentValues($argumentName, $context);
+
if ( $argumentName === 'scheduled_task_name' ) {
return $this->getScheduledTaskNames();
}
- return array();
+ return $suggestions;
}
/**

Event Timeline