kameloso.config

Functionality related to configuration; verifying it, correcting it, reading it from/writing it to disk, and parsing it from command-line arguments.

Employs the standard std.getopt to read arguments from the command line to construct and populate instances of the structs needed for the bot to function, like IRCClient, IRCServer and IRCBot.

Members

Functions

applyDefaults
void applyDefaults(Kameloso instance)

Completes a client's, server's and bot's member fields. Empty members are given values from compile-time defaults.

flatten
auto flatten(string[] arr, string separator)

Flattens a dynamic array of strings by splitting elements containing more than one value (as separated by a separator string) into separate elements.

giveBrightTerminalHint
void giveBrightTerminalHint(Flag!"alsoAboutConfigSetting" alsoConfigSetting)

Display a hint about the existence of the --bright getopt flag.

giveConfigurationMinimalInstructions
void giveConfigurationMinimalInstructions()

Displays a hint on how to complete a minimal configuration file.

handleGetopt
auto handleGetopt(Kameloso instance)

Reads command-line options and applies them over values previously read from the configuration file, as well as dictates some other behaviour.

manageConfigFile
void manageConfigFile(Kameloso instance, Flag!"shouldWriteConfig" shouldWriteConfig, Flag!"shouldOpenTerminalEditor" shouldOpenTerminalEditor, Flag!"shouldOpenGraphicalEditor" shouldOpenGraphicalEditor, Flag!"force" force)

Writes and/or edits the configuration file. Broken out into a separate function to lower the size of handleGetopt.

notifyAboutIncompleteConfiguration
void notifyAboutIncompleteConfiguration(string configFile, string binaryPath)

Displays an error if the configuration is *incomplete*, e.g. missing crucial information.

notifyAboutMissingSettings
void notifyAboutMissingSettings(string[][string] missingEntries, string binaryPath, string configFile)

Prints some information about missing configuration entries to the local terminal.

printHelp
void printHelp(GetoptResult results)

Prints the getopt "helpWanted" help table to screen.

printSettings
void printSettings(Kameloso instance)

Prints the core settings and all plugins' settings to screen.

resolveFlagString
void resolveFlagString(string input, bool output)

Resolves a string to a boolean value.

verboselyWriteConfig
void verboselyWriteConfig(Kameloso instance, IRCClient client, IRCServer server, IRCBot bot, Flag!"giveInstructions" giveInstructions)

Writes configuration to file, verbosely.

writeConfigurationFile
void writeConfigurationFile(Kameloso instance, string filename)

Writes all settings to the configuration filename passed.

writeToDisk
void writeToDisk(string filename, string configurationText, Flag!"addBanner" banner)

Saves the passed configuration text to disk, with the given filename.

See Also

Meta