CLI Specification

Using the command line interface

The DC/OS command-line interface (CLI) is a utility to manage cluster nodes, install and manage packages, inspect the cluster state, and manage services and tasks. The DC/OS CLI is open and extensible: anyone can create a new subcommand and make it available for installation by end users. For example, the Spark DC/OS service provides CLI extensions for working with Spark. When installed, you can type the following command to submit Spark jobs and query their status:

dcos spark [<flags>] <command>

How the DC/OS CLI discovers subcommands

When you run the dcos command, it searches the current shell’s PATH for executables with names that are prefixed with dcos- in the ~/.dcos/clusters/<cluster_id>/subcommands/<package_name>/env/bin directory.

Installing a CLI subcommand

IMPORTANT: CLI modules are cluster specific and stored in ~/.dcos/clusters/"cluster_id"/subcommands. You must install a CLI module for each cluster. For example, if you connect to cluster 1 and install the Spark module, then connect to cluster 2, which is also running Spark. Spark CLI commands are not available until you install the module for that cluster.

Creating a DC/OS CLI subcommand

Requirements

Executables for Mac, Linux, and Windows

Standard flags

You must assign a standard set of flags to each DC/OS CLI subcommand, described below:

--info
--help
-h

–info

The --info flag shows a short, one-line description of the function of your subcommand. This content is displayed when the user runs dcos help.

Example from the Spark CLI:

dcos spark --info
Spark DC/OS CLI Module

When you run the dcos command without parameters, the info is returned for each subcommand:

dcos | grep spark
spark Spark DC/OS CLI Module

–help and -h

The --help and -h flags both show the detailed usage for your subcommand.