Option

The option command depends on the place it’s placed in:

Top-level

At the top-level block (file) it is used to define options, as such a block is required! The first and only parameter is the name of the (global) option.

Arguments
# Name Type Info
0 name str

The name of the option

Expanded?: ❌

Inside a target

When inside a target, the block becomes optional, and a optional second parameter is added. The first argument is the name of the option, and the optional second one can only be the identifier public.

When no block is given, the command tries to apply an global option to the target; if public is specified, the option is also applied to any target that depends on the current one.

When a block is given, a target-local option is defined, and the meaning of public is the same.

Arguments
# Name Type Info
0 name str

The name of the option

Expanded?: ❌
1 public (optional) sym Allowed values:
  • public

Defining an option

Defining an option is done inside a supplied block to the option command. The following subcommands exist:

desc

Much like desc inside a target, this one simply sets a human readable description for the option.

Arguments
# Name Type Info
0 value str

The description of the option

Expanded?: ❌

default

Sets the default value of the option, if none is configured via the user. The values on and off have special meaning and will get translated to their boolean equivalent.

Arguments
# Name Type Info
0 value str

The default value of the option

Expanded?: ❌

values

Sets the list of allowed values.

Arguments
# Name Type Info
0+ value vararg

The default values of the option; only strings allowed!

Varargs

validator

The validator block is used so nitto can validate that any given option’s value is actually valid to use. This can range from allowing dynamic values to checking if dependencies that the option requires are actually given.

The first argument of this command is the action, means how the validator should go on to validate the option.

Currently there is only the exec action which takes an second argument of type string, which then will be treated as an commandline to be executed. See below for more details.

Arguments
# Name Type Info
0 action sym

The action to do when validating

apply

The apply command does not take any argument, only a block. It’s content gets applied to any target the option itself is applied on. As such, you can use here any command that you also would use inside the target’s block.

Validation

exec

The exec-validator whill execute an program. It gives the programm following env-variables:

  • OPTION_NAME: the name of the option
  • OPTION_VALUE: the current value of the option; this value is also those that should be validated
  • TARGET_NAME: name of the target this option is applied to currently
  • TARGET_TYPE: type of the target (library / binary)

The validator-programm can set custom data onto the target by replying with key=value lines on stdout. To indicate a success, the program must exit with code 0; any other exitstatus is assumed to indicate an error.