help.php 610 Bytes
Newer Older
1 2 3 4 5 6 7 8
<?php namespace Laravel\CLI\Tasks;

use Laravel\Str;
use Laravel\File;

class Help extends Task {

	/**
Shawn McCool committed
9
	 * List available artisan commands. 
10 11 12 13 14
	 *
	 * @return void
	 */
	public function commands()
	{
Shawn McCool committed
15
		// read help contents
16

Shawn McCool committed
17
		$command_data = json_decode(File::get(__DIR__.'/help.json'));
18

Shawn McCool committed
19
		// format and display help contents
20

Shawn McCool committed
21
		$i=0;
22 23 24 25 26 27 28 29 30 31 32 33 34
		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);
			}
		}
	}
}