Command Line

Ringo comes with a command line tool for running scripts and work with an interactive shell.

Writing command line scripts with Ringo is straightforward. To make a script work both as a command and as a module you can use the following boilerplate code.

// “conditional script” stanza

function main(args) {
    // your code
}


// is this the main module executed?
if (require.main === module) {
    main(system.args);
}

This will call function main only if the script is run as a command line script. Otherwise it will act like an ordinary module. The require, module, and system objects used in this piece of code are provided by Ringo.

The command line scripts bundled with Ringo may also serve as a learning aid.

Modules of particular interest for CLI

edit this page | list all pages | go home