Comments on: New command line usage

Carl Sassenrath, CTO
REBOL Technologies
9-Apr-2009 2:41 GMT

Article #0190
Main page || Index || Prior Article [0189] || Next Article [0191] || 1 Comments || Send feedback

R3-A47 handles the command line args much better. The host and core are processing them; however, we still have some work to do in intrinsic/begin to act on them.

To see what's now allowed:

>> usage
Command line usage:

        REBOL <options> <script> <arguments>

All parts are optional.

Standard options:

        --args data      Explicit arguments to script (quoted)
        --do expr        Evaluate expression (quoted)
        --help (-?)      Display this usage information
        --import file    Import a module prior to script
        --script file    Explicit script filename
        --version tuple  Script must be this version or greater

Special options:

        --cgi (-c)       Load CGI utiliy module and modes
        --debug flags    Enable debug flags for script to use
        --halt (-h)      Leave console open when script is done
        --quiet (-q)     No startup banners or information
        --secure policy  Can be: none allow ask throw quit
        --trace (-t)     Enable trace mode during boot
        --verbose        Show detailed startup information

Other quick options:

        -s               No security
        +s               Full security
        -v               Display release version only


        REBOL script.r
        REBOL -s script.r
        REBOL script.r 10:30
        REBOL --do "watch: on" script.r

Notice that I left --cgi, even though it's not that important anymore (because in R3 it can be done in REBOL code). But, I think we can use that flag to load a CGI utilities module, which most CGI scripts need.

The new --debug flag is something I've wanted for a while. It's intended for your programs to check and act on as needed.

The --import function allows you to import another module before your program runs. It's the kind of thing you see in other languages, but we will need to see how useful it is for us. If not useful, we'll remove it.


The system options object holds all of the above fields that are provided on startup. The general mechanism is:

  1. If the command line flag is provided, it will appear in the system/option/flags block.
  2. If it has an associated value, that will be stored in the system/options object.

For example:

r3 --debug test example.r

You will see:

>> system/options/flags
[debug true]

This method (placing TRUE at end) is used so you can write:

if system/options/flags/debug [...]

The test value provided on the command line will be found here:

>> system/options/debug

That block is intended for use by your program/script, to enable your debug code in whatever way you want. It is not used by the system itself.

Note that the field must be valid REBOL source, or an error will occur.

You can also use string delimiters to pass multiple flags:

r3 --debug "net: on log: on" example.r
>> system/options/debug
[net: on log: on]

So, that let's you do quite a lot.



13-May-2009 19:01:12
Very happy with the maturation of R3 shown in some recent developments. R3 is now at a state where I can commit a large-scale project to initiate development with it. :)!!!

I particularly agree about the --debug flag; this capability being explicit now, is truly welcome.

The "--cgi" flag is probably worthwhile even with that functionality now in R3; given the amount of CGI code still in use, this will support incrementally upgrading code to R3 (when this is possible) where an app is left in a hybrid state, at intermediate dev milestones.

Bringing up security enough to push it ahead of other current priorities was a wise decision. The new proposals map out enough structure to enable and help ensure reasonably organic implementations. Such granularity of security permissions and access control is essential to market acceptance (...and, certainly, you knew that).

At this point, my perception is that R3 development is starting to exhibit a synergy of organization where, because enough critical components are now well-enough defined, most of the remaining important areas gain implications of how they will fit into the emerging overall structure, and how their roles will integrate into the whole.

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 25-Jun-2024 - Edit - Copyright REBOL Technologies -