public static function task($name, $desc, $files = null, $addVerboseOption = true) { if (is_null($files)) { $files = pantr::fileset()->name('*Test.php')->in('test'); } $task = pantr::task($name, $desc); if ($addVerboseOption) { $task = $task->option('verbose')->shorthand('v')->desc('Output detailed test information'); } return $task->run(function ($req = array()) use($files) { return PHPUnit::forAllTests($files)->run(isset($req['verbose'])); }); }
function task($name, $fnOrDesc = null, $fn = null) { return pantr::task($name, $fnOrDesc, $fn); }
* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ use pantr\pantr; use pantr\core\Status; use pantr\core\Application; use pantr\ext\Phar; use pantr\ext\PEAR; PEAR::registerTasks(); pantr::task('help', 'Display this help message')->usage('help <task>')->option('global-tasks')->shorthand('g')->desc('Show global pantr tasks only')->run(function ($req) { // show info on one task if (isset($req[0])) { $taskName = $req[0]; $tasks = pantr::getDefinedTasks(); if (isset($tasks[$taskName])) { $task = $tasks[$taskName]; if ($task->getName() == 'help') { $task->desc('Display detailed information for a task'); } $task->printHelp(); } } else { // show summary of all tasks pantr::writeln('Usage:', pantr::SECTION)->write('pantr [options]')->write(' <task> ', pantr::PARAMETER)->writeln('[args]'); Application::printOptions();