Skip to content

Commit

Permalink
命令行。。。
Browse files Browse the repository at this point in the history
  • Loading branch information
xsir317 committed Nov 26, 2014
1 parent b1a9cb4 commit 5deed73
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
68 changes: 68 additions & 0 deletions publisher/app/commands/TaskCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
//runs like php artisan tasks:run 123

class TaskCommand extends Command {

/**
* The console command name.
*
* @var string
*/
protected $name = 'tasks:run';

/**
* The console command description.
*
* @var string
*/
protected $description = 'This is a daemon process handles tasks in nebula.tasks table.';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
echo "hello , ".$this->argument('example');
}

/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('example', InputArgument::REQUIRED, 'An example argument.'),
);
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
);
}

}
2 changes: 1 addition & 1 deletion publisher/app/start/artisan.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
| the console gets access to each of the command object instances.
|
*/

Artisan::add(new TaskCommand);

0 comments on commit 5deed73

Please sign in to comment.