Closed andriokha closed 2 years ago
Thought a possible alternative might be to change it dynamically from within the REPL itself, but it looks like that's not possible at the mo: https://github.com/bobthecow/psysh/issues/361
Ah, I can use a psysh config file without any change to drush. In combination with the PSYSH_CONFIG
env var I can use something like
PSYSH_CONFIG=config-multiline.php drush php
I'll leave the request open because it's not super convenient, see what others think (:
Thanks!
K, I'm going to close this. If you'd like to be able to copy and paste a single logical line that's spread over multiple actual lines in drush core:cli
you can use the following.
<?php
return [
'requireSemicolons' => TRUE,
];
PSYSH_CONFIG=path/to/file/from/docroot/file.php drush php
\Drupal::entityTypeManager()
->getStorage('node')
->getQuery()
->count()
->accessCheck(FALSE)
->execute();
Thanks!
You should also be able to add a .psysh.php
file with that config to your project directory and it'll do this by default!
Is your feature request related to a problem? Please describe. By default psysh does a kind of JS-like automatic semicolon insertion for convenience, automatically adding one after each line break. And a lot of time it's convenient. But I'm always frustrated when I have a bit of multiline code that I want to test in the REPL, and instead of just copying and pasting, I have to reformat it onto one line.
Describe the solution you'd like Psysh has an option that requires semicolons:
requireSemicolons
. I've tested it locally and it works as advertised. I suggest supporting that. I'm not sure if it makes more sense to have a dedicated option, or a general mechanism to pass psysh config options through (insert obligatory xkcd reference!).Thanks for this life-saving tool :heart: