3.2.1 Short Packs

A short pack allows you to group multiple short forms in a single command-line item. For instance, instead of calling your program like this: ‘program -c -u -p’, you can directly use: ‘program -cup’.

A short pack can only contain options the short names of which are exactly one character long. Also, it should be obvious that you cannot provide an argument to an option in a pack. As a consequence, only flags and options with optional (and not provided) arguments may appear in a short pack.

There is one exception however: it is possible to provide an argument to the last option in the pack. If provided, this argument must be located in the next command-line item. It cannot be sticked to the option, so this means in particular that this option’s argument is mandatory (see Valued Options).

Beware that using short packs comes at the risk of ambiguity. When Clon parses a command-line item beginning with only one dash, it tries to detect options first, options with a sticky argument next, and then short packs. For that reason, you cannot possibly start a pack with a valued option. Indeed, suppose that the option ‘-c’ takes an argument. What you think is a short pack (‘-cup’) will in fact be interpreted as the option ‘-c’ with a sticky (and maybe invalid) argument ‘up’. On the other hand, if the option ‘-u’ is only a flag (see Flags), then you can safely pack your options in a different order, like this: ‘-ucp’.

A single command-line may contain as many short packs as you like, and they can also be intermixed with regular option calls.