addOption method
void
addOption(})
Implementation
void addOption(String name,
{String? abbr,
String? description,
String? environment,
Type type = String,
bool required = false,
dynamic defaultValue}) {
if (_params.any((element) => element.name == name)) {
throw BoostException('Option name already in use: --"$name"');
}
if (abbr != null && _params.any((element) => element.abbr == abbr)) {
throw BoostException('Option abbreviation already in use: -"$abbr"');
}
if (environment != null &&
_params.any((element) => element.environment == environment)) {
throw BoostException(
'Option environment variable already in use: "$environment"');
}
if (!allowedTypes.contains(type)) {
throw BoostException('Type "$type" not supported by ConfigParser.');
}
_params.add(_ConfigParam(
name, abbr, environment, description, type, defaultValue, required));
}