I am working on a cake shell script. When I use some named arguments eg:
--username=world
how can I get the "username" param / value?
My code looks like this:
class InviteShell extends AppShell
{
//... here are my methods.
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addArgument('username', array(
'help' => 'Send E-Mail to which user?'
))->addOption('method', array(
'short' => 'm',
'help' => __('The specific method you want help on.')
))->description(__('Lookup doc block comments for classes in CakePHP'));
return $parser;
}
}
And what is the difference between argument and option? And also how can I read these options in my code?
The one thing that works is I can read the $this->args array, but this is not named. All I can do is get the arg by index, eg.: $this->args[0]
I am using Cake 2.9