# sfCommandLine plug-in The `sfCommandLine` provide a centralized way to launch batch script and passing them complex arguments. It also allow to change the SP_APP, SP_ENVIRONMENT and SP_DEBUG directly from command line. ## Installation * Install the plug-in symfony plugin-install http://plugins.symfony-project.com/sfCommandLinePlugin * Clear the cache symfony cc * You're done. ## Usage $ ./symfony run my_batch --env dev --app backend --debug -t -h --long-arg with-value ## Example Create a test script batch/test.php : <?php echo "env = ".SF_ENVIRONMENT."\n"; var_dump($argv); Change the environment from command line : $ ./symfony run test --env test env = test array(1) { ["env"]=> string(4) "test" } $ ./symfony run test --env dev env = dev array(1) { ["env"]=> string(4) "dev" } Pass long arguments : $ ./symfony run test --long_var --long_var_with_value foobar env = prod array(2) { ["long_var"]=> bool(true) ["long_var_with_value"]=> string(6) "foobar" } Pass short arguments : $ ./symfony run test -a foo -b -cd bar env = prod array(4) { ["a"]=> string(3) "foo" ["b"]=> bool(true) ["c"]=> bool(true) ["d"]=> string(3) "bar" } ## Bugs or features requests Please, submit any bugs or features requests on the [forum](http://www.symfony-project.org/forum/index.php/t/9938/) ## Changelog ### 2007-11-23 | 0.1.0 * romain: plug-in added to symfony ### 2007-11-26 | 0.1.1 * romain: !BugFix : missing SF_ROOT_DIR constant