Symfony 1.1 Task Options in Windows
Symfony 1.1's tasks are pretty nice. They let you centralise all the administration of your website that would usually happen through a myriad of batch scripts. When you're writing a task, you'll probably define a command line option as follows:
$this->addOption('env', null, sfCommandOption::PARAMETER_OPTIONAL,
'Changes the environment this task is run in', 'prod');
But if you're running Windows, any attempt to use your new command line option will be met with failure:
>symfony se:build-search --env="test"
The execution of task "se:build-search" failed.
- Too many arguments ("se:build-search test" given).
symfony se:build-search [--env[="..."]] [--force[="..."]]
The gotcha is that Symfony's example syntax for using the command line argument/option won't work with Windows' cmd.exe, because it considers the "=" sign to be an argument separator. To use an option, you'll want to do this:
>symfony se:build-search "--env=test"
That is, enclose the whole option, including the option name, in speech marks. That'll escape the equals sign.