The Orion Shell: Not your father’s TTY

A new addition in the Orion 0.5 release is its Console page, which provides a command-line interface (CLI) for interacting with Orion.  Note that as of the Orion 1.0 release this page has been renamed to the “Shell” page in order to avoid confusion with browser Javascript consoles.  References to the page and its associated service description have been updated throughout this post to use their new names that are current as of Orion 1.0.

Under the covers the page uses GCLI, a component from that strives to provide a more powerful CLI that’s suited to today’s modern context, rather than duplicating the command-line experience that evolved in days of old.  An attribute of GCLI that immediately stands out is the various forms of assistance it provides during command entry, while not hindering the productivity of the CLI-enamored power user.

The Shell page provides some basic commands for navigating an Orion workspace (pwd, ls, cd, edit).  These commands are useful and demonstrate the shell in action.

Beyond these basic commands, the Shell page defines a service that enables plug-ins to contribute new commands.  The service properties and implementation are reasonably intuitive and are similar to the service, so it’s easiest to just delve into an example (a more formal description of this service can be found in the Orion wiki).  The following example contributes an “echo” command, and as an added twist accepts an optional boolean parameter to indicate whether the echoed string should be reversed.  (For basic info on creating Orion plug-ins see Simple Plug-in Example).

<!DOCTYPE html>
    <meta charset="UTF-8" />
    <title>Shell 'echo' Plugin</title>
    <script src="/orion/plugin.js"></script>
        window.onload = function() {
            var serviceProperties = { 
                name: "echo",
                description: "Echo a string",
                manual: "This is an example implementation...",
                parameters: [{
                    name: "string",
                    type: "string",
                    description: "The string to echo back"
                }, {
                    name: "reverse",
                    type: "boolean",
                    description: "Reverse the string"
            var serviceImpl = {
                callback: function(args) {
                    var string = args.string;
                    if (args.reverse === true) {
                        string = string.split("").reverse().join("");
                    return "<b>" + string + "<\/b>";
            var provider = new eclipse.PluginProvider();

Loading this plug-in into Orion and then returning to the Shell page shows that the echo command has been added.

An important aspect of contributing a command to the Shell page is specification of its parameter types, as this enables argument validation and in many cases some form of content assist.  The basic set of parameter types is { string | boolean | number | array | selection | deferred }.  The echo command’s first parameter is specified to just be a string, so its potential value range is wide open.  Its second parameter (reverse) is a boolean, so it will only be allowed to adopt a value of true or false.

The service implementation receives the command arguments, which are guaranteed to satisfy the specified parameter types.  It simply checks for “reversed === true“, and returns an HTML-formatted result accordingly.  The following image shows the echo command in action.

Thanks to Kris De Volder (VMware) for the initial investigation and implementation of Orion’s console/shell facilities, and Joe Walker ( for authoring and maintaining GCLI and providing assistance during Orion’s initial uptake.

This entry was posted in Tips & Tricks. Bookmark the permalink.