Welcome the CodeMRI® CLI Reference. The CodeMRI® Command-line Interface (CLI) provides an easy to use interface for administering and using your CodeMRI® product. To get started, see General Invocation.
General Invocation
The CodeMRI® CLI consists of a tree of commands and sub-commands, grouped by the concept or element that the command interacts with. For example, all commands that deal with logging in and logging out are nested under account as they relate to account management.
usage: cmri <command sub-command ...> [common options...] [command-options...]
Commands and sub-commands are delimited by spaces. For example, the sub-command list under job would look like:
cmri job list
See the Command Listing section at the bottom of this document for a full listing of commands within the CodeMRI® CLI.
Common Options
In addition to command-specific options, all commands within the CodeMRI® CLI support the following common options:
| The path to the vault to connect to (run |
| One or more expressions that match elements within the vault to work with. If not provided, the CodeMRI® CLI use the value of the |
| Specifies the desired format of command output, where possible. Commands that do not output any data, or certain special cases (e.g. help commands) will simply ignore the argument to |
| Specifies the path to an output file to write command output to. Commands that do not support output, or certain special cases (e.g. help commands) will simply ignore the argument to |
| Removes colored text from console output. Useful for screens where colored text is difficult to see (such as on old projectors). |
Environment Variables
| The vault path, if the |
| The selection set, if the |
Output Formats
The CodeMRI® CLI supports the following output formats:
| Human readable tabular or textual format. This is the default output format. |
| A series of newline-delimited rows with columns delimited by commas ( |
|
|
| A series of newline-delimited rows with columns delimited by tabs. The first row will be a header containing column names. |
|
|
| Either a single object or an array of JSON objects. |
Interactive Shell
The CodeMRI® CLI supports an interactive shell for running multiple commands in a single session. This is useful for situations where users need to perform a number of small operations without incurring the cost of starting up the CLI multiple times, or for working with complex selection sets not conducive to the single-line selection expressions afforded by --select
and CMRI_SELECT
.
To launch the CodeMRI® shell, run:
cmri shell
Using the interactive shell requires a path to a valid data vault be present in either the argument to the --vault
option or the CMRI_VAULT
environment variable. The --vault
option is not supported from within the shell, it is not possible to change the active vault within the scope of a single session.
To run commands in the shell, enter the command name sans the cmri
prefix at the >
prompt. For example to run cmri job list
from the interactive shell, type:
job list
To exit the interactive shell, type exit
at the prompt and hit enter.
Batch Scripting
For running a script containing multiple commands within a single session, the CodeMRI® CLI supports batch scripting. To run a batch script, use:
cmri batch run <script path>
CodeMRI® can accept batch scripts through standard input on Linux platforms. Replace <script path>
with /dev/stdin
to process a script on standard input.
Syntax
Batch scripts consist of a sequence of CodeMRI® commands, sans the cmri
prefix. Empty lines or lines whose first non-whitespace character is #
will be skipped.
Error Handling
If an error occurs during a batch script, whether due to an invalid command, invalid options, or a problem executing the command, CodeMRI® will print the error to standard error and stop processing the script.
Invoking the Interactive Shell
By issuing the shell
command within a script, users can create scripts that execute a sequence of commands, and then enter an interactive shell in the same session. This can be useful for setting up a complex selection set on which to run a set of interactive commands.