Skip to content

taskphp/console

Repository files navigation

task/console

Build Status Coverage Status

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());
}]);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages