Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / drush / drush / src / Drupal / Commands / core / CliCommands.php
index 538893b96ce02bb4881e7c76414f1b5555d00b7f..4c3b732e5c4dc4da65cbdbd2ad562211132c88b7 100644 (file)
@@ -15,6 +15,7 @@ use Webmozart\PathUtil\Path;
 
 class CliCommands extends DrushCommands
 {
+
     /**
      * Drush's PHP Shell.
      *
@@ -34,10 +35,12 @@ class CliCommands extends DrushCommands
      * @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();
 
@@ -78,6 +81,12 @@ class CliCommands extends DrushCommands
             $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();
     }
 
@@ -94,14 +103,13 @@ class CliCommands extends DrushCommands
         $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();