Clio is an argument-parsing library designed for building elegant command-line interfaces.

Command Line Interface

Clio supports the same core feature set across all its language implementations:


Clio supports four kinds of options: boolean, string, integer, and floating-point.

An option can have an unlimited number of long-form aliases and single-character shortcuts: --option, -o.

Option values can be separated by either a space, --opt 123, or an equals symbol, --opt=123. Either syntax can be used with shortcuts: -o 123, -o=123.

Multiple shortcuts can be condensed into a single block, e.g. -abc foo bar. Trailing arguments are consumed in sequence as required by the options.

Options are registered with default values which are retained if the option is not found. If an option is found multiple times its value is the final value encountered — i.e. the value of -o 123 -o 456 is 456.

List Options

List options store multiple values. A list option can be greedy or non-greedy depending on its eagerness to consume arguments.

A greedy option will attempt to consume as many arguments as it can, continuing until it meets a new option or runs out of arguments.

Positional Arguments

Options can be preceded, followed, or interspaced with positional arguments. Clio assembles all positional arguments together into a single, undifferentiated list of strings. Convenience functions are supplied for parsing these strings as integers or floats.

Clio supports the standard -- switch for turning off option-parsing. All arguments following a -- will be treated as positional arguments, even if they begin with a single or double dash.


Clio supports git-style command interfaces with arbitrarily-nested commands. Commands have builtin support for an automatic --help flag and an automatic help <cmd> command, i.e. the commands

$ myapp <cmd> --help


$ myapp help <cmd>

are functionally identical and will both print the help text registered with the command.