$darkmode
Elektra 0.11.0
Definition of Bool

Problem

Inconsistent use of booleans in various parts of Elektra.

Constraints

Assumptions

Considered Alternatives

Decision

Only the strings 0 and 1 are allowed in the KeySet for type = boolean, for both values and defaults. Everything else should lead to errors in checkers (in kdbSet).

A spec with type = boolean without a specified default should be interpreted as default = 0.

Example for an implementation in C in an application:

if (k != NULL && strcmp(keyString(k), "1") == 0) {/*true*/} else {/*false*/}

Storage plugins are allowed any representation as suitable, e.g., a JSON plugin might render 1 as true.

The type checker plugin should allow

Rationale

Implications

Related Decisions

Notes