IRCPluginImpl.setSettingByName

Change a plugin's Settings-annotated settings struct member by their string name.

This is used to allow for command-line argument to set any plugin's setting by only knowing its name.

mixintemplate IRCPluginImpl(Flag!"debug_" debug_ = No.debug_, string module_ = __MODULE__)
@safe override
bool
setSettingByName
(
const string setting
,
const string value
)

Parameters

setting string

String name of the struct member to set.

value string

String value to set it to (after converting it to the correct type).

Return Value

Type: bool

true if a member was found and set, false otherwise.

Examples

@Settings struct FooSettings
{
    int bar;
}

FooSettings settings;

setSettingByName("bar", 42);
assert(settings.bar == 42);

Meta