Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fancier multiline support for `wp shell` #316
I just came accross a very neat feature in the CoffeeScript REPL:
And now you can enter multiple lines of input, which will get evaluated only when you press Ctrl+V again.
Given the limited meta-programming abilities in PHP, I think this approach would make the most sense for the WP shell.
PS: CoffeeScript also supports adding a
While Ctrl+V would definitely work, it’s one shortcut too many :-)
In most of the cases when I want multi-line input, I am trying to execute a single, but multi-line statement: a function, a
A few options:
Yes, I know Python does that; that's why I quit my PHP job. :P
Personally, I'm not going to bother trying to match delimiters or mess with the PHP parser. If someone does tackle this, they should package it up as a generic library, since I'm sure many people would find it useful in their own PHP REPLs.
referenced this issue
Apr 30, 2013
It seems someone has already gone through the pain of wading through PHP tokens to provide multiline support. It's an abandoned project called php-shell:
The multiline part is used in the WordPress Console plugin: