hostilefork / replpad-js

Interactive Web Console for Rebol language (Ren-C branch)
GNU Lesser General Public License v3.0
13 stars 9 forks source link

Wish: run the replpad with a GET parameter #43

Open gchiu opened 5 years ago

gchiu commented 5 years ago

eg. http://hostilefork.com/media/shared/replpad-js?do=nzpower

or http://hostilefork.com/media/shared/replpad-js/?do=<nzpower>

so the replpad immediately runs the user utility instead of dropping to the console.

hostilefork commented 5 years ago

I definitely like the idea of having some syntax for this.

Rather than just doing something random for it, though, I feel like we should look at the finer points and actually design the arguments feature.

So not only would we be thinking about what the right levels of indirection are (a table like the one where <nzpower> lives to be translated into a URL), but also running scripts from GitHub URLs, or passing arguments to these scripts.

Also these parameters have to live alongside other parameters for controlling the behavior of the ReplPad, such as the developer parameter for running from a local build of libr3.

I know little about conventions for this kind of parameterization, so if anyone has things they know it might be good to start from listing that.

hostilefork commented 5 years ago

@gchiu was impatient so I added a very basic version of this feature, despite lack of a formal specification:

https://github.com/hostilefork/replpad-js/commit/a57e3f366a485c85b1672f824e7507b744ed40f2

I still would like a reasoned formal specification. There are questions here about how this interacts with the REPL, e.g. when it should drop you to it after running... kind of all the same questions we'd have about specifying on the command line. It would be nice if there could be some consistency in the switches, e.g. r3 --do xxx lining up with ?do=xxx in some way.

Before this goes any further I'd like to understand what notations and escapings are legal or illegal, and such. There's issues like how <script> in the shell introduces file redirection with > and <...and I know these are likely tricky URL characters. Let's try and see if this can be done in a forward-looking way.

(See also new helper: JS-EVAL, for easily getting string/integer/null values from JavaScript expressions...and a bugfix for PRINT after a ReplPad-Reset)