Selector plugin

Description The selector plugin is used for selecting a configuration path based on the value(s) of a target, typically one from a pattern value.

Mandatory settings

The configuration of the command-line-command must contain the following settings:

patterns

A list of patterns to apply on the command line. See Patterns (5).

targets

The targets to select on. Note that if patterns are used in this list, they must be listed using the patterns configuration, as is the case for every plugin.

The runtime value(s) associated with the pattern key must resolve either to an existing (configured) plugin or a configured command.

Optional settings

There are no optional settings for the selector plugin.

Example

Configuration

# Usage:
#   'exec-helper --settings-file <this file> example' will execute both the example1 and example2 target.
# Adding the --example <example-value> will only execute the given <example-value>. E.g.:
#   'exec-helper --settings-file <this file> example --example example1' will execute the example1 target only.

commands:
    example: An example for using the selector plugin

patterns:
    SELECTOR:                       # Define the pattern to select on.
        default-values:
            - example1
            - example2
        short-option: e
        long-option: --example

example:                            # Use the selector for the example command
    - selector

selector:
    patterns:
        - SELECTOR              # Tell the selector plugin to use the SELECTOR pattern for deciding which paths to trigger
    targets: [ "{SELECTOR}" ]   # Execute the target when the selector is activated. The target is a permutation of the values in the registered patterns

example1:                           # Define the 'example1' path
    - command-line-command

example2:                           # Define the 'example2' path
    - command-line-command

command-line-command:
    example1:
        command-line: [ echo, example1]
    example2:
        command-line: [ echo, example2]

Usage

Save the example to an exec-helper configuration file and execute in the same directory:

eh example

See also

See exec-helper (1) for information about the usage of exec-helper.

See Custom plugins (5) for the available plugins and their configuration options.

See Configuration (5) for information about the configuration file format.