Files
spa-api/laravel/cli/tasks/help.php

34 lines
610 B
PHP
Raw Normal View History

2012-07-12 00:30:04 +02:00
<?php namespace Laravel\CLI\Tasks;
use Laravel\Str;
use Laravel\File;
class Help extends Task {
/**
2012-07-16 10:28:40 +02:00
* List available artisan commands.
2012-07-12 00:30:04 +02:00
*
* @return void
*/
public function commands()
{
2012-07-16 10:28:40 +02:00
// read help contents
2012-07-12 00:30:04 +02:00
2012-07-16 10:28:40 +02:00
$command_data = json_decode(File::get(__DIR__.'/help.json'));
2012-07-12 00:30:04 +02:00
2012-07-16 10:28:40 +02:00
// format and display help contents
2012-07-12 00:30:04 +02:00
2012-07-16 10:28:40 +02:00
$i=0;
2012-07-12 00:30:04 +02:00
foreach($command_data as $category => $commands)
{
if($i++ != 0) echo PHP_EOL;
echo PHP_EOL . "# $category" . PHP_EOL;
foreach($commands as $command => $details)
{
echo PHP_EOL . str_pad($command, 20) . str_pad($details->description, 30);
}
}
}
}