Running URLs from the command line

I thought it would be neat to try out the new decorated URL redirection in the console, by running a URL!. So I tried:

r3 https://github.com/metaeducation/rebol-odbc/blob/master/tests/odbc-test.reb rebol-firebird --firebird

This didn't give me what I wanted:

** Access Error: cannot open: %/https/github.com/metaeducation/rebol-odbc/blob/master/tests/odbc-test.reb

It Thought That Was A Filename...

And oddly enough, it could have been.

On Linux, you can make a directory called https:. Double slashes are collapsed to assume you meant a single slash. It could be interpreted as a path.

We Should Default This To Treating It As A URL

I think it's pretty obvious that should be running a script from a network location. But if people want a file interpretation there should be a way to do that. Should we let the % character disambiguate it?

r3 %http://example.com/script.r

If so, how to deal with files that actually start with %? %%?

Or maybe something like:

r3 --file http://example.com/script.r

In any case, it's not entirely clear what program logic we should use here to interpret this. Do we explicitly try to see if something can LOAD as a URL! and if not, assume it's a filename? Do we look more narrowly for alphanumerics followed by a colon? Special cases for http and https only, for now?

I'm hacking in the alphanumerics followed by colon. But the edge case of a "weird" filename should be tended to someday.

2 Likes

Adding one more % than there are at the start of the filename would be possible.

I vote for out of band signalling with --file and --url respectively.