Since: 1.0
Author: Bernhard Schussek (bschussek@gmail.com)
Inheritance: extends Webmozart\Console\Api\Config\ApplicationConfig
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     $this->setEventDispatcher(new EventDispatcher());
     parent::configure();
     $this->setName('dancer')->setDisplayName('SkeletonDancer')->addOption('project-directory', null, Option::OPTIONAL_VALUE, 'The root directory of the project, this is where the ".dancer" directory is located. ' . 'When omitted the directory is automatically searched by the first occurrence of the ".dancer" directory
             in the parent directory structure, and falls back to the current working directory.')->addOption('config-file', null, Option::OPTIONAL_VALUE | Option::NULLABLE, 'Configuration file to load. When omitted the file `.dancer.yml` is automatically searched in the parent directory structure. Pass "null" to disable', '')->addOption('overwrite', null, Option::REQUIRED_VALUE, 'Default operation for existing files: abort, skip, force, ask, backup')->setVersion(self::VERSION)->setDebug('true' === getenv('SKELETON_DANCER_DEBUG'))->addStyle(Style::tag('good')->fgGreen())->addStyle(Style::tag('bad')->fgRed())->addStyle(Style::tag('warn')->fgYellow())->addStyle(Style::tag('hl')->fgGreen());
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, function (PreHandleEvent $event) {
         // Set-up the IO for the Symfony Helper classes.
         if (!isset($this->container['console_io'])) {
             $io = $event->getIO();
             $args = $event->getArgs();
             $input = new ArgsInput($args->getRawArgs(), $args);
             $input->setInteractive($io->isInteractive());
             $this->container['console_io'] = $io;
             $this->container['console_args'] = $args;
             $this->container['sf.console_input'] = $input;
             $this->container['sf.console_output'] = new IOOutput($io);
         }
     });
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, new ProjectDirectorySetupListener($this->container));
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, new AutoLoadingSetupListener($this->container));
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, new ExpressionFunctionsProviderSetupListener($this->container));
     $this->beginCommand('generate')->setDescription('Generates a new skeleton structure in the current directory')->addArgument('profile', Argument::OPTIONAL, 'The name of the profile')->addOption('all', null, Option::BOOLEAN, 'Ask all questions (including optional)')->addOption('dry-run', null, Option::BOOLEAN, 'Show what would have been executed, without actually executing')->setHandler(function () {
         return new Handler\GenerateCommandHandler($this->container['style'], $this->container['config'], $this->container['profile_config_resolver'], $this->container['answers_set_factory']);
     })->end()->beginCommand('profile')->setDescription('Manage the profiles of your project')->setHandler(function () {
         return new Handler\ProfileCommandHandler($this->container['style'], $this->container['profile_config_resolver'], $this->container['config']);
     })->beginSubCommand('list')->setHandlerMethod('handleList')->markDefault()->end()->beginSubCommand('show')->addArgument('name', Argument::OPTIONAL, 'The name of the profile')->setHandlerMethod('handleShow')->end()->end();
 }
 protected function configure()
 {
     parent::configure();
     $this->setName('tabular');
     $this->setVersion('0.1');
     $this->beginCommand('report')->setDescription('Generate a console report from an XML file and a tabular configuration file.')->setHandler(new ReportCommandHandler())->addArgument('xml', Argument::REQUIRED, 'XML file to process')->addArgument('definition', Argument::REQUIRED, 'Tabular definition to use')->addOption('debug', null, Option::NO_VALUE, 'Show debug output');
 }
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     parent::configure();
     $this->setName('php-scoper')->setDisplayName('PHP-Scoper')->setVersion(self::VERSION)->setDebug('@pack' . 'age_version@' === self::VERSION);
     $this->beginCommand('add-prefix')->addArgument('prefix', Argument::REQUIRED, 'The namespace prefix to add. Must end with a backslash.')->addArgument('path', Argument::REQUIRED | Argument::MULTI_VALUED, 'The path(s) to process.')->setHandler(function () {
         return new AddPrefixCommandHandler();
     })->end();
 }
Exemplo n.º 4
0
 protected function setUp()
 {
     $config = DefaultApplicationConfig::create()->setDisplayName('The Application')->setVersion('1.2.3')->beginCommand('the-command')->end();
     $this->application = new ConsoleApplication($config);
     $this->command = $this->application->getCommand('the-command');
     $this->helpCommand = $this->application->getCommand('help');
     $this->io = new BufferedIO();
     $this->handler = new HelpXmlHandler();
 }
Exemplo n.º 5
0
 protected function setUp()
 {
     $config = DefaultApplicationConfig::create()->beginCommand('the-command')->end();
     $this->application = new ConsoleApplication($config);
     $this->command = $this->application->getCommand('the-command');
     $this->helpCommand = $this->application->getCommand('help');
     $this->io = new BufferedIO();
     $this->handler = new HelpJsonHandler();
 }
Exemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     // Make sure the console and Puli use the same event dispatcher so that
     // Puli plugins can listen to the console events.
     // Add the dispatcher before parent::configure() so that the parent
     // listeners don't get overwritten.
     $this->setEventDispatcher($this->puli->getEventDispatcher());
     parent::configure();
     $puli = $this->puli;
     $this->setName('puli')->setDisplayName('Puli')->setVersion(self::VERSION)->setDebug('@pack' . 'age_version@' === self::VERSION)->addStyle(Style::tag('good')->fgGreen())->addStyle(Style::tag('bad')->fgRed());
     $this->beginCommand('bind')->setDescription('Bind resources to binding types')->setHandler(function () use($puli) {
         return new BindCommandHandler($puli->getDiscoveryManager(), $puli->getPackageManager()->getPackages());
     })->beginOptionCommand('add')->markAnonymous()->addArgument('query', Argument::REQUIRED, 'A query for resources')->addArgument('type', Argument::REQUIRED, 'The name of the binding type')->addOption('language', null, Option::REQUIRED_VALUE, 'The language of the resource query', 'glob', 'language')->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'A binding parameter in the form <key>=<value>', null, 'key=value')->addOption('force', 'f', Option::NO_VALUE, 'Add binding even if the binding type does not exist')->setHandlerMethod('handleAdd')->end()->beginOptionCommand('list')->markDefault()->addOption('root', null, Option::NO_VALUE, 'Show bindings of the root package')->addOption('package', 'p', Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Show bindings of a package', null, 'package')->addOption('all', 'a', Option::NO_VALUE, 'Show bindings of all packages')->addOption('enabled', null, Option::NO_VALUE, 'Show enabled bindings')->addOption('disabled', null, Option::NO_VALUE, 'Show disabled bindings')->addOption('undecided', null, Option::NO_VALUE, 'Show bindings that are neither enabled nor disabled')->addOption('type-not-found', null, Option::NO_VALUE, 'Show bindings whose type is not found')->addOption('type-not-enabled', null, Option::NO_VALUE, 'Show bindings whose type is not enabled')->addOption('ignored', null, Option::NO_VALUE, 'Show bindings whose type is disabled')->addOption('invalid', null, Option::NO_VALUE, 'Show bindings with invalid parameters')->addOption('language', null, Option::REQUIRED_VALUE, 'The language of the resource query', 'glob', 'language')->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'A binding parameter in the form <key>=<value>', null, 'key=value')->setHandlerMethod('handleList')->end()->beginOptionCommand('update', 'u')->addArgument('uuid', Argument::REQUIRED, 'The UUID (prefix) of the updated binding')->addOption('query', null, Option::REQUIRED_VALUE, 'A query for resources')->addOption('type', null, Option::REQUIRED_VALUE, 'The name of the binding type')->addOption('language', null, Option::REQUIRED_VALUE, 'The language of the resource query', null, 'language')->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'A binding parameter in the form <key>=<value>', null, 'key=value')->addOption('unset-param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Unset a binding parameter', null, 'key')->addOption('force', 'f', Option::NO_VALUE, 'Update binding even if the binding type does not exist')->setHandlerMethod('handleUpdate')->end()->beginOptionCommand('delete', 'd')->addArgument('uuid', Argument::REQUIRED, 'The UUID (prefix) of the removed binding')->setHandlerMethod('handleDelete')->end()->beginOptionCommand('enable')->addArgument('uuid', Argument::REQUIRED, 'The UUID (prefix) of the enabled binding')->setHandlerMethod('handleEnable')->end()->beginOptionCommand('disable')->addArgument('uuid', Argument::REQUIRED, 'The UUID (prefix) of the disabled binding')->setHandlerMethod('handleDisable')->end()->end();
     $this->beginCommand('build')->setDescription('Build the resource repository/discovery')->addArgument('target', Argument::OPTIONAL, 'The build target. One of "repository", "discovery", "factory" and "all"', 'all')->setHandler(function () use($puli) {
         return new BuildCommandHandler($puli->getRepositoryManager(), $puli->getDiscoveryManager(), $puli->getFactoryManager());
     })->end();
     $this->beginCommand('config')->setDescription('Display and modify configuration values')->setHandler(function () use($puli) {
         return new ConfigCommandHandler($puli->getRootPackageFileManager());
     })->beginSubCommand('list')->markDefault()->addOption('parsed', null, Option::NO_VALUE, 'Replace placeholders by their values in the output')->setHandlerMethod('handleList')->end()->beginSubCommand('show')->markAnonymous()->addArgument('key', Argument::REQUIRED, 'The configuration key to show. May contain wildcards ("*")')->addOption('parsed', null, Option::NO_VALUE, 'Replace placeholders by their values in the output')->setHandlerMethod('handleShow')->end()->beginSubCommand('set')->markAnonymous()->addArgument('key', Argument::REQUIRED, 'The modified configuration key')->addArgument('value', Argument::REQUIRED, 'The value to set for the configuration key')->setHandlerMethod('handleSet')->end()->beginOptionCommand('reset', 'r')->addArgument('key', Argument::REQUIRED, 'The configuration key(s) to reset. May contain wildcards ("*")')->setHandlerMethod('handleReset')->end()->end();
     $this->beginCommand('find')->setDescription('Find resources by different criteria')->addOption('path', null, Option::REQUIRED_VALUE, 'The resource path. May contain the wildcard "*"')->addOption('name', null, Option::REQUIRED_VALUE, 'The resource filename. May contain the wildcard "*"')->addOption('class', null, Option::REQUIRED_VALUE, 'The short name of a resource class')->addOption('type', null, Option::REQUIRED_VALUE, 'The name of a binding type')->addOption('language', null, Option::REQUIRED_VALUE, 'The language of the query passed with --path', 'glob')->setHandler(function () use($puli) {
         return new FindCommandHandler($puli->getRepository(), $puli->getDiscovery());
     })->end();
     $this->beginCommand('installer')->setDescription('Manage the installers used to install web resources')->setHandler(function () use($puli) {
         return new InstallerCommandHandler($puli->getInstallerManager());
     })->beginOptionCommand('list')->markDefault()->addOption('long', 'l', Option::NO_VALUE, 'Print the fully-qualified class name')->setHandlerMethod('handleList')->end()->beginOptionCommand('add', 'a')->addArgument('name', Argument::REQUIRED, 'The name of the installer')->addArgument('class', Argument::REQUIRED, 'The fully-qualified class name of the installer')->addOption('description', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'The description of the installer')->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Additional installer parameters')->setHandlerMethod('handleAdd')->end()->beginOptionCommand('delete', 'd')->addArgument('name', Argument::REQUIRED, 'The name of the installer to remove')->setHandlerMethod('handleDelete')->end()->end();
     $this->beginCommand('ls')->setDescription('List the children of a resource in the repository')->addArgument('path', Argument::OPTIONAL, 'The path of a resource', '/')->addOption('long', 'l', Option::NO_VALUE, 'Print more information about each child')->setHandler(function () use($puli) {
         return new LsCommandHandler($puli->getRepository());
     })->end();
     $this->beginCommand('map')->setDescription('Display and change path mappings')->setHandler(function () use($puli) {
         return new MapCommandHandler($puli->getRepositoryManager(), $puli->getPackageManager()->getPackages());
     })->beginOptionCommand('add')->markAnonymous()->addArgument('path', Argument::REQUIRED)->addArgument('file', Argument::REQUIRED | Argument::MULTI_VALUED)->addOption('force', 'f', Option::NO_VALUE, 'Map even if the target path does not exist')->setHandlerMethod('handleAdd')->end()->beginOptionCommand('list')->markDefault()->addOption('root', null, Option::NO_VALUE, 'Show mappings of the root package')->addOption('package', 'p', Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Show mappings of a package', null, 'package')->addOption('all', 'a', Option::NO_VALUE, 'Show mappings of all packages')->addOption('enabled', null, Option::NO_VALUE, 'Show enabled mappings')->addOption('not-found', null, Option::NO_VALUE, 'Show mappings whose referenced paths do not exist')->addOption('conflict', null, Option::NO_VALUE, 'Show conflicting mappings')->setHandlerMethod('handleList')->end()->beginOptionCommand('update', 'u')->addArgument('path', Argument::REQUIRED)->addOption('add', 'a', Option::REQUIRED_VALUE | Option::MULTI_VALUED | Option::PREFER_LONG_NAME, 'Add a file to the path mapping', null, 'file')->addOption('remove', 'r', Option::REQUIRED_VALUE | Option::MULTI_VALUED | Option::PREFER_LONG_NAME, 'Remove a file from the path mapping', null, 'file')->addOption('force', 'f', Option::NO_VALUE, 'Map even if the target path does not exist')->setHandlerMethod('handleUpdate')->end()->beginOptionCommand('delete', 'd')->addArgument('path', Argument::REQUIRED)->addArgument('file', Argument::OPTIONAL)->setHandlerMethod('handleDelete')->end()->end();
     $this->beginCommand('package')->setDescription('Display the installed packages')->setHandler(function () use($puli) {
         return new PackageCommandHandler($puli->getPackageManager());
     })->beginOptionCommand('add', 'a')->addArgument('path', Argument::REQUIRED, 'The path to the package')->addArgument('name', Argument::OPTIONAL, 'The name of the package. Taken from puli.json if not passed.')->addOption('installer', null, Option::REQUIRED_VALUE, 'The name of the installer', InstallInfo::DEFAULT_INSTALLER_NAME)->setHandlerMethod('handleAdd')->end()->beginOptionCommand('list')->markDefault()->addOption('installer', null, Option::REQUIRED_VALUE, 'Show packages installed by a specific installer')->addOption('enabled', null, Option::NO_VALUE, 'Show enabled packages')->addOption('not-found', null, Option::NO_VALUE, 'Show packages that could not be found')->addOption('not-loadable', null, Option::NO_VALUE, 'Show packages that could not be loaded')->addOption('format', null, Option::REQUIRED_VALUE, 'The format of the output. You can use the variables %name%, %install_path%, %installer% and %state% in the format string', null, 'format')->setHandlerMethod('handleList')->end()->beginOptionCommand('rename')->addArgument('name', Argument::REQUIRED, 'The name of the package')->addArgument('new-name', Argument::REQUIRED, 'The new name of the package')->setHandlerMethod('handleRename')->end()->beginOptionCommand('delete', 'd')->addArgument('name', Argument::REQUIRED, 'The name of the package')->setHandlerMethod('handleDelete')->end()->beginOptionCommand('clean')->setHandlerMethod('handleClean')->end()->end();
     $this->beginCommand('plugin')->setDescription('Manage the installed Puli plugins')->setHandler(function () use($puli) {
         return new PluginCommandHandler($puli->getRootPackageFileManager());
     })->beginOptionCommand('install', 'i')->addArgument('class', Argument::REQUIRED, 'The fully-qualified plugin class name')->setHandlerMethod('handleInstall')->end()->beginOptionCommand('list')->markDefault()->setHandlerMethod('handleList')->end()->beginOptionCommand('delete', 'd')->addArgument('class', Argument::REQUIRED, 'The fully-qualified plugin class name')->setHandlerMethod('handleDelete')->end()->end();
     $this->beginCommand('publish')->setDescription('Manage public resources')->setHandler(function () use($puli) {
         return new PublishCommandHandler($puli->getAssetManager(), $puli->getInstallationManager(), $puli->getServerManager());
     })->beginOptionCommand('add')->markAnonymous()->addArgument('path', Argument::REQUIRED, 'The resource path')->addArgument('server', Argument::REQUIRED, 'The resource path')->addArgument('server-path', Argument::OPTIONAL, 'The path in the document root of the server', '/')->addOption('force', 'f', Option::NO_VALUE, 'Map even if the server does not exist')->setHandlerMethod('handleAdd')->end()->beginOptionCommand('update', 'u')->addArgument('uuid', Argument::REQUIRED, 'The UUID (prefix) of the mapping')->addOption('path', null, Option::REQUIRED_VALUE, 'The resource path')->addOption('server', 's', Option::REQUIRED_VALUE | Option::PREFER_LONG_NAME, 'The name of the target server')->addOption('server-path', null, Option::REQUIRED_VALUE, 'The path in the document root')->addOption('force', 'f', Option::NO_VALUE, 'Update even if the server does not exist')->setHandlerMethod('handleUpdate')->end()->beginOptionCommand('delete', 'd')->addArgument('uuid', Argument::REQUIRED, 'The UUID (prefix) of the mapping')->setHandlerMethod('handleDelete')->end()->beginOptionCommand('list', 'l')->markDefault()->setHandlerMethod('handleList')->end()->beginOptionCommand('install')->addArgument('server', Argument::OPTIONAL, 'The server to install. By default, all servers are installed')->setHandlerMethod('handleInstall')->end()->end();
     $this->beginCommand('self-update')->setDescription('Update Puli to the latest version.')->addOption('stable', null, Option::NO_VALUE, 'Update to the latest stable version')->addOption('unstable', null, Option::NO_VALUE, 'Update to the latest unstable version')->setHandler(function () {
         return new SelfUpdateCommandHandler();
     })->enableIf('phar://' === substr(__DIR__, 0, 7))->end();
     $this->beginCommand('server')->setDescription('Manage your asset servers')->setHandler(function () use($puli) {
         return new ServerCommandHandler($puli->getServerManager());
     })->beginOptionCommand('list')->markDefault()->setHandlerMethod('handleList')->end()->beginOptionCommand('add', 'a')->addArgument('name', Argument::REQUIRED, 'The name of the added server')->addArgument('document-root', Argument::REQUIRED, 'The document root of the server')->addOption('installer', null, Option::REQUIRED_VALUE, 'The name of the used installer', 'symlink')->addOption('url-format', null, Option::REQUIRED_VALUE, 'The format of the generated resource URLs', Server::DEFAULT_URL_FORMAT)->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Additional parameters required by the resource installer')->setHandlerMethod('handleAdd')->end()->beginOptionCommand('update', 'u')->addArgument('name', Argument::REQUIRED, 'The name of the updated server')->addOption('document-root', null, Option::REQUIRED_VALUE, 'The document root of the server')->addOption('installer', null, Option::REQUIRED_VALUE, 'The name of the used installer', 'symlink')->addOption('url-format', null, Option::REQUIRED_VALUE, 'The format of the generated resource URLs', Server::DEFAULT_URL_FORMAT)->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Additional parameters required by the resource installer')->addOption('unset-param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Parameters to remove from the server')->setHandlerMethod('handleUpdate')->end()->beginOptionCommand('delete', 'd')->addArgument('name', Argument::REQUIRED, 'The name of the server to remove')->setHandlerMethod('handleDelete')->end()->end();
     $this->beginCommand('tree')->setDescription('Print the contents of a resource as tree')->addArgument('path', Argument::OPTIONAL, 'The path of a resource', '/')->setHandler(function () use($puli) {
         return new TreeCommandHandler($puli->getRepository());
     })->end();
     $this->beginCommand('type')->setDescription('Display and change binding types')->setHandler(function () use($puli) {
         return new TypeCommandHandler($puli->getDiscoveryManager(), $puli->getPackageManager()->getPackages());
     })->beginOptionCommand('define')->addArgument('name', Argument::REQUIRED, 'The name of the binding type')->addOption('description', null, Option::REQUIRED_VALUE, 'A human-readable description of the type')->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'A type parameter in the form <key> or <key>=<value>', null, 'key=value')->addOption('param-description', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'A human-readable parameter description in the form <key>=<description>', null, 'key=description')->addOption('force', 'f', Option::NO_VALUE, 'Add type even if another type exists with the same name')->setHandlerMethod('handleDefine')->end()->beginSubCommand('list')->markDefault()->addOption('root', null, Option::NO_VALUE, 'Show types of the root package')->addOption('package', 'p', Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Show types of a package', null, 'package')->addOption('all', 'a', Option::NO_VALUE, 'Show types of all packages')->addOption('enabled', null, Option::NO_VALUE, 'Show enabled types')->addOption('duplicate', null, Option::NO_VALUE, 'Show duplicate types')->setHandlerMethod('handleList')->end()->beginOptionCommand('update')->addArgument('name', Argument::REQUIRED, 'The name of the binding type')->addOption('description', null, Option::REQUIRED_VALUE, 'A human-readable description of the type')->addOption('param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'A type parameter in the form <key> or <key>=<value>', null, 'key=value')->addOption('param-description', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'A human-readable parameter description in the form <key>=<description>', null, 'key=description')->addOption('unset-param', null, Option::REQUIRED_VALUE | Option::MULTI_VALUED, 'Unset a type parameter', null, 'key')->setHandlerMethod('handleUpdate')->end()->beginOptionCommand('delete', 'd')->addArgument('name', Argument::REQUIRED, 'The name of the binding type')->setHandlerMethod('handleDelete')->end()->end();
 }
Exemplo n.º 7
0
 protected function setUp()
 {
     $config = DefaultApplicationConfig::create()->setName('the-app')->setDisplayName('The Application')->setVersion('1.2.3')->beginCommand('the-command')->end();
     $this->manDir = __DIR__ . '/Fixtures/man';
     $this->asciiDocDir = __DIR__ . '/Fixtures/ascii-doc';
     $this->application = new ConsoleApplication($config);
     $this->command = $this->application->getCommand('the-command');
     $this->helpCommand = $this->application->getCommand('help');
     $this->io = new BufferedIO();
     $this->executableFinder = $this->getMockBuilder('Symfony\\Component\\Process\\ExecutableFinder')->disableOriginalConstructor()->getMock();
     $this->processLauncher = $this->getMockBuilder('Webmozart\\Console\\Process\\ProcessLauncher')->disableOriginalConstructor()->getMock();
     $this->handler = new HelpHandler($this->executableFinder, $this->processLauncher);
     $this->handler->setManDir($this->manDir);
     $this->handler->setAsciiDocDir($this->asciiDocDir);
 }
 public function testUseConfiguredStyleSet()
 {
     $styleSet = new StyleSet();
     $styleSet->add(Style::tag('custom'));
     $this->config->setStyleSet($styleSet)->beginCommand('command')->setHandler(new CallbackHandler(function (Args $args, IO $io) {
         PHPUnit_Framework_Assert::assertSame('text', $io->removeFormat('<custom>text</custom>'));
         return 123;
     }))->end();
     $application = new ConsoleApplication($this->config);
     $args = new StringArgs('command');
     $inputStream = new StringInputStream();
     $outputStream = new BufferedOutputStream();
     $errorStream = new BufferedOutputStream();
     $status = $application->run($args, $inputStream, $outputStream, $errorStream);
     $this->assertSame(123, $status);
 }
Exemplo n.º 9
0
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();
        $configurationLoader = new ConfigurationLoader();
        $configurationDumper = new ConfigurationDumper();
        $filesystem = new Filesystem();
        $signature = <<<SIGNATURE
  _   _   ___    ____   ___   ____   _   _     _
 | | | | / _ \\  / ___| / _ \\ / ___| | | | |   / \\
 | |_| || | | || |  _ | | | |\\___ \\ | |_| |  / _ \\
 |  _  || |_| || |_| || |_| | ___) ||  _  | / ___ \\
 |_| |_| \\___/  \\____| \\___/ |____/ |_| |_|/_/   \\_\\

SIGNATURE;
        $this->setDisplayName($signature . "\n" . 'Hogosha Monitoring Tool')->setName('monitor')->setVersion(Monitor::VERSION)->addOption('config', 'c', Option::OPTIONAL_VALUE, 'Config file path', rtrim(getcwd(), DIRECTORY_SEPARATOR))->beginCommand('init')->setDescription('Create a default configuration file if you do not have one')->setHandler(function () use($configurationLoader, $configurationDumper, $filesystem) {
            return new InitHandler($configurationLoader, $configurationDumper, $filesystem);
        })->setHelp('php <info>bin/monitor</info> init')->addOption('force', 'f', Option::OPTIONAL_VALUE, 'Overwrite the config file')->end()->beginCommand('run')->setDescription('Launch the monitor process')->setHandler(function () use($configurationLoader) {
            return new RunHandler($configurationLoader);
        })->setHelp('php <info>bin/monitor</info> run')->addOption('format', 'f', Option::OPTIONAL_VALUE, 'The formatter', 'list')->end();
    }
 protected function configure()
 {
     parent::configure();
     $this->addEventListener(ConsoleEvents::PRE_HANDLE, [$this, 'initApplication']);
 }
Exemplo n.º 11
0
 protected function configure()
 {
     parent::configure();
     $this->setName('Cpm')->setVersion('1.0.0')->beginCommand('search')->addArgument('package', Argument::OPTIONAL, 'Package Name/Description/Keywords')->addOption('limit', 'l', Argument::OPTIONAL, 'limit result numbers', null, 'limitValue')->setDescription('Search all packages from packagist.org')->setHandler(new SearchCommandHandler())->end()->beginCommand('download')->addArgument('package', Argument::OPTIONAL, 'Package Name/Description/Keywords')->setDescription('Search all packages from packagist.org')->setHandler(new SearchCommandHandler())->end();
 }
 protected function configure()
 {
     parent::configure();
     $this->setName('php-enigma2')->setVersion('1.0.0')->beginCommand('upload')->setDescription('Upload bouquets files')->setHandler(new UploadCommandHandler())->addArgument('path', Argument::REQUIRED, 'Path')->end()->beginCommand('download')->setDescription('Download and extract bouquets file')->setHandler(new DownloadCommandHandler())->addArgument('url', Argument::REQUIRED, 'Url')->end()->beginCommand('reload')->setDescription('Reload bouquets')->setHandler(new ReloadCommandHandler())->end();
 }
Exemplo n.º 13
0
<?php

use Webmozart\Console\Config\DefaultApplicationConfig;
use Webmozart\Console\ConsoleApplication;
use Webmozart\Console\Handler\CallbackHandler;
require_once __DIR__ . '/../../vendor/autoload.php';
$config = DefaultApplicationConfig::create()->setTerminateAfterRun(true)->editCommand('help')->setHandler(new CallbackHandler(function () {
    return 123;
}))->end();
$application = new ConsoleApplication($config);
$application->run();
// Should not be executed
exit(234);
Exemplo n.º 14
0
 protected function configure()
 {
     parent::configure();
     $this->setName('Cpm-Server')->setVersion('1.0.0')->beginCommand('build')->setDescription('download metadata from packagist.org')->setHandler(new BuildCommandHandler())->end()->beginCommand('download')->setDescription('download two from packagist.org')->setHandler(new DownloadCommandHandler())->end();
 }