Module dentist.common.configfile

Validate and parse config files.

Functions

NameDescription
fromBytes(bytes) Convert bytes to the smallest unit such that the value is between 0 and 1.
parseConfig(configFile) Create Options from configFile.
retroInitFromConfig(options, configFile) Retroactively initialize options from config.
toBytes(value, unit) Convert value with unit to bytes.
toJson(yaml) Convert yaml into Json as good as possible. Since YAML is a strict superset of JSON it not always possible BUT every valid config file can be converted.
validateConfigCommand(commandConfig) Validate config for Options.commandName.
validateConfigFile(configFile) Validates the format and structure of configFile. These rules must be
assignConfigValue(options, configValue) Convert and assign configValue to member in options.
getConfigValue(configValue) Convert configValue to SymbolType.
parseConfigFile(configFileName) Parse configFileName into a JSON struct.
readConfigFile(configFileName) Read configFileName into a string respecting a maximum file size of maxConfigSize bytes.
validateConfig(configValues) Validates the format and structure of configFile. These rules must be

Classes

NameDescription
ConfigFileException Thrown if an error while handling config file occurs.

Enums

NameDescription
SizeUnit Set of size units for toBytes and fromBytes.

Manifest constants

NameTypeDescription
configCommentPrefix Keys prefixed with this string are ignored.
configDefaultKey Identifier for the config object with default values.
configEmptyArgument Arguments with this value are assigned the config value.
maxConfigSize Maximum size of a valid config file.
sizeUnitBase Base for size units.
configNamesOf Get an array of names that can be used in a config file to reference symbol. If symbol is an argument it will split the argument name by colon (:) and return the last part stripped off its last character (which should be a >). If symbol is an option it will return the list of names that were provided. Otherwise, an empty array is returned.