class CliCommands extends DrushCommands
{
+
/**
* Drush's PHP Shell.
*
* @aliases php,core:cli,core-cli
* @option $version-history Use command history based on Drupal version
* (Default is per site).
+ * @option $cwd Changes the working directory of the shell
+ * (Default is the project root directory)
* @topics docs:repl
* @remote-tty
*/
- public function cli(array $options = ['version-history' => false])
+ public function cli(array $options = ['version-history' => false, 'cwd' => null])
{
$configuration = new Configuration();
$bootstrap->terminate();
}
+ // If the cwd option is passed, lets change the current working directory to wherever
+ // the user wants to go before we lift psysh.
+ if ($options['cwd']) {
+ chdir($options['cwd']);
+ }
+
$shell->run();
}
$ignored_commands = [
'help',
'php:cli',
- 'core:cli',
- 'core-cli',
- 'php',
+ 'core:cli',
+ 'php',
'php:eval',
- 'eval',
- 'ev',
+ 'eval',
+ 'ev',
'php:script',
- 'scr',
+ 'scr',
];
$php_keywords = $this->getPhpKeywords();