clojure/tools.cli — Issue #3: Should support subcommands
Author: babilen
Created: 2011-11-04 16:08:17+00:00
State: open

Subcommands are a common requirement in many CLI applications and tools.cli should be able to handle them. In short, tools.cli should be able to parse the following command:

foo --option1 --option2 baz subcommand --sub-option1 --sub-option2 quux arg1 arg2

where `option1` and `option2` are options of `foo`, `subcommand` is one of a number of pre-defined subcommands. It should furthermore be possible to define options for subcommands as well, which is exemplified by `sub-option1` and `sub-option2`.

I started to work on this, but have not yet found a satisfying way to incorporate the information for subcommands in the return values of `cli` in a way that does *not* break backwards compatibility *again*. The convention of returning a triple of `options`, `args` and `help string` might not be flexible enough to incorporate this and future requirements.