CodeMRI CLI Reference

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:

--vault

The path to the vault to connect to (run cmri vault --help for more information about vaults). In the case of vault create, this specifies the path to the vault to create. If not provided, the CodeMRI® CLI will fall back to the value of the CMRI_VAULT environment variable, and finally, the current directory. Please note that folders or sub-folders within the installation path may not be used as vaults.

-s, --selection

One or more expressions that match elements within the vault to work with. If not provided, the CodeMRI® CLI use the value of the CMRI_SELECTION environment variable. See cmri select or run cmri select --help for more information about selection.

--output-format

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 --output-format. See Output Formats for information about output formats.

--out

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 --out. Output files will be overwritten.

--no-color

Removes colored text from console output. Useful for screens where colored text is difficult to see (such as on old projectors).

Environment Variables

CMRI_VAULT

The vault path, if the --vault option is not provided. See vault or run cmri vault --help for more information about vaults.

CMRI_SELECTION

The selection set, if the --selection option is not provided. See cmri select or run cmri select --help for more information about selection.

Output Formats

The CodeMRI® CLI supports the following output formats:

human

Human readable tabular or textual format. This is the default output format.

csv

A series of newline-delimited rows with columns delimited by commas (,). The first row will be a header containing column names. Values with commas in them will be be quoted with double quotes.

csv:noheader

csv format without the header. Useful for appending to an existing CSV.

tsv

A series of newline-delimited rows with columns delimited by tabs. The first row will be a header containing column names.

tsv:noheader

tsv format without the header. Useful for appending item to an existing TSV.

json

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.

Using Understand 6:

To use Understand 6 on Linux first use CMRI to create scans with Understand 5 (default) on ANY system. This is the default functionality and does not require any changes on your part. Once this has been done you can add a new system and follow the steps below.


The default analysis engine for new systems is Understand 5 (understand).

Upon the creation of a new system, if you would like to analyze your system with Understand 6 instead of Understand 5, use:

cmri system config set analysis_engine understand6

A system's analysis_engine value cannot be set back to Understand 5 (understand) if the given system has already ran an analysis using Understand 6.

To set a system's analysis_engine back to Understand 5, create a new system using the cmri system add command and keep the default analysis_engine value: understand.

Command Listing