Closed nbertal closed 11 years ago
As I said in #3: I'm not at home till wednesday and will test it afterwards
I can't reproducce this, it works for me. Can you post your command?
I copy here the 2 usefull excerpts of my pupdate command...
Declaring the options :
protected function getOptions()
{
return array(
array('archive', 'a', InputOption::VALUE_NONE, 'Archive past events.', null),
array('uoid', 'o', InputOption::VALUE_NONE, 'Update owners\' id.', null),
);
}
Main command code:
public function fire()
{
// retrieving options
$options = $this->option();
$this->info('options: ' . json_encode( $this->option() ));
// not any of the options available -> fail
if( !$options['archive'] && !$options['uoid'] ) {
$this->error('You need to specify either --(a)rchive or --u(o)id');
}
[...]
}
When i type: artisan command:pupdate --archive or artisan command:pupdate -a
it returns: options: {"archive":false,"uoid":false,"help":false,"quiet":false,"verbose":false,"version":false,"ansi":false,"no-ansi":false,"no-interaction":false,"env":null} You need to specify either --(a)rchive or --u(o)id
Ok I can confirm it, will fix it tomorrow
Wow, thanks ! :)
I'm trying to launch custom made commands (http://laravel.com/docs/commands) through Web Artisan, but it apparently fails to recognize options (--this) and arguments.
In order to debug a little I put the following line at the begining of the command fire() function : $this->info(options: ' . json_encode( $this->option() ));
It showed options were always set to false.