task / console
Utilities for working with Symfony's Console component and Task
Installs: 17 270
Dependents: 3
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- symfony/console: ~2.4
- task/plugin: ~1.1
Requires (Dev)
- henrikbjorn/phpspec-code-coverage: 1.0.*@dev
- phpspec/phpspec: 2.0.*@dev
- satooshi/php-coveralls: ~0.6
- task/task: ~0.1
This package is not auto-updated.
Last update: 2024-12-21 17:27:39 UTC
README
Example
use Some\Application; use Task\Plugin\Console\ApplicationPlugin; $project->inject(function ($container) { $app = new Application; $container['app'] = new ApplicationPlugin($app) }); $project->addTask('run', ['app', function ($app) { $app->command('run') ->setVerbose(true) ->pipe($this->getOutput()); }]);
Installation
Add to composer.json
:
... "require-dev": { "task/console" "~0.2" } ...
Usage
ApplicationPlugin::command()
returns a CommandRunner
which dynamically builds up command arguments and options with setter methods.
Given the following InputDefinition
:
[ new InputOption('option', 'o', InputOption::VALUE_REQUIRED), new InputOption('flag', 'f', InputOption::VALUE_NONE), new InputArgument('arg', InputArgument::REQUIRED) ]
$project->addTask('run', ['app', function ($app) { $app->command('run') ->setOption('foo') ->setFlag(true) ->setArg('wow') ->pipe($this->getOutput()); }]);