Shorthand

A shorthand is a mapping from an executable name to a list of values, that are inserted before the specified commandline when the program starts and the executable name matches. Alternative executable names can be created by copying, or linking to, the normal executable name.

For those familiar with Unix/Linux this is how fgrep works the same as if you typed grep -F.

The tag for defining a shorthand is !Shorthand. If this tag is within a subcommand definition, it can be followed by just a scalar, which is the name of the executable or by a mapping. Such a mapping can also appear at the toplevel. The mapping consists of one or more executable names as keys, with as value for each key either a scalar string or a list of scalar strings.

Lets assume the following artificial cligen data is for a command dv:

!Cli 0:
- !Option [verbose, v, !Help increase verbosity level, !Action count]
- !Shorthand
  vdv: -v
  vdvv: [-v, version]
- make:
  - !DefaultSubCommand
  - !Help make the utility
- version:
  - !Help show or manipulate the version number embedded in the source code
  - !Option [major, !Help 'increment major version number, sets minor and micro to 0']
  - !Option [minor, !Help 'increment minor version number, sets micro  to 0']
  - !Option [micro, !Help 'increment micro version number']
  - !Shorthand dvv
  - !Shorthand
    dvmic: [version, --micro]

with the apropriate links to, or copies of, dv to vdv, vdvv, dvv, dvmic (using ln -s dv vdv or cp dv vdv; chmod +x vdv) executing dvmic -v would be the same as executing dv version --micro -v.

In the above !Shorthand dvv is itself short for

  - !Shorthand
    dvv: version

as the expansion is taken to be the subcommand name.