[ Home | Main Table Of Contents | Table Of Contents | Keyword Index ]

cmdr_development(n) 1.0 doc "Cmdr, a framework for command line parsing and dispatch"


cmdr_development - Cmdr - The Developer's Guide

Table Of Contents


Welcome to the Cmdr project, written by Andreas Kupries.

For availability please read Cmdr - How To Get The Sources.

The audience of this document are anyone wishing to modify Cmdr in any way, shape, or form. This can be a maintainer fixing bugs, a developer adding functionality, or patching it to accommodate local cicumstances, etc.

Please read

  1. Cmdr - How To Get The Sources and

  2. Cmdr - The Installer's Guide

first, if that was not done already. Here we assume that the sources are already available in a directory of your choice, that it is known how to build and install the project, and that all the necessary requisites are available.

Development Tools

Cmdr requires the following tools going beyond those needed for build and installation.


Processor for diagram-based figures. See package tklib.


Processor for doctools-based documentation files, i.e. the ".man" files under "doc/". See package tcllib.

This requirement is optional. If a Tcllib providing the package dtplite is installed then kettle will use the package in favor of the external application.

Demonstration/Example Applications

Cmdr (currently) does not have demonstrations, nor examples.

Directory structure

The directory structure of the sources is as explained below:


The main file of the kettle-based build-system.


Main directory for all documentation.

Based on the doctools package and tools provided by Tcllib.


Main directory for all diagrams and figures used by the documentation.

Based on the diagram package and tools provided by Tklib.


Compiled documentation (manpages and HTML). Part of the repository for

  1. easy access from the repository's web interface (embedded documentation), and

  2. quicker installation (no need to compile during the installation process itself).


Main directory for the test-suite.

Based on the tcltest package distributed with the Tcl core.


Package cmdr::actor.


Package cmdr.


Package cmdr::config.


Package cmdr::help.


Package cmdr::help::json.


Package cmdr::help::sql.


Package cmdr::officer.


Package cmdr::parameter.


Package cmdr::private.


Package cmdr::util.


Package cmdr::validate.


Package cmdr::validate::common.

Extended Build Actions

Our build-system is based on kettle, as already explained in the Cmdr - The Installer's Guide. Beyond the targets useful for installation it also provides targets aiding developers and maintainers. These are:

Validation of the documentation
% /path/to/cmdr/build.tcl validate-doc
Regeneration of the embedded documentation
% /path/to/cmdr/build.tcl doc
Regeneration of the figures for the documentation
% /path/to/cmdr/build.tcl figures
Execution of the test-suite

The most basic execution of the test-suite is done with

% /path/to/cmdr/build.tcl test

When the test-suite reports issues with the framework use of the more extended form below is indicated, with a <stem> of your choice. This will generate a number of files whose name starts with the prefix "<stem>.". These will contain extended test logs, details about errors and failures, etc.

% /path/to/cmdr/build.tcl test --log <stem>

Architecture & Concepts

All packages in the framework belong to one of three layers, as shown below:


Note that:

The dependencies between the packages are very straight-forward, following mostly directly out of the relationships shown above, plus the few where the utilities are imported. To reduce the complexity of the diagram below a few direct dependencies on cmdr::util were omitted where indirectly present through other dependencies (i.e. through cmdr::help):


Validation Types

Everything said in the public document Cmdr - Writing custom validation types applies to the standard validation types of the framework (as listed in Cmdr - Standard validation types for parameters) as well.

Help Formats

Everything said in the public document Cmdr - Writing custom help formats applies to the standard help formats of the framework (as listed in Cmdr - (Internal) Utilities for help text formatting and setup) as well.

Command Line Completion

The document Cmdr - Internals of command line completion describes the inner workings of the command line completion provided by the framework.

Common Blocks

The framework reserves all blocks whose name begins with a star, i.e *, for its own use. Currently the following names are in use:


Publicly documented for users, this block is expected to contain parameter specification commands. These commands are automatically added to all privates found in the command hierarchy containing the block.

The details are explained by the description of command common in Cmdr - Officer Specification Language.


Publicly documented for users, this block is expected to contain a dictionary mapping from toplevel section/category names to an integer number to override the natural order of displaying these sections in the help.

The details are explained in section Format Notes of Cmdr - (Internal) Utilities for help text formatting and setup.


Publicly documented for users as read-only this block's value is managed by the framework. Set during the Dispatch phase it provides to access to the actual command name used to invoke a private.

See also section Execution of Cmdr - Runtime Processing Flow.


Publicly documented for users as read-only this block's value is managed by the framework. Not set until the first main- or mini-shell was active its value is boolean flag indicating if an interactive shell is currently active (true) or not (false, or not existing).

See also section Execution of Cmdr - Runtime Processing Flow.

Related Documents

  1. Cmdr - Introduction to the project

  2. Cmdr - License

  3. Cmdr - Log of Changes

  4. Cmdr - How To Get The Sources

  5. Cmdr - The Installer's Guide

  6. Cmdr - The Developer's Guide

Bugs, Ideas, Feedback

Both the package(s) and this documentation will undoubtedly contain bugs and other problems. Please report such at Cmdr Tickets.

Please also report any ideas you may have for enhancements of either package(s) and/or documentation.


arguments, command hierarchy, command line completion, command line handling, command tree, editing command line, help for command line, hierarchy of commands, interactive command shell, optional arguments, options, parameters, processing command line, tree of commands