zorael / kameloso

IRC bot with Twitch support
Boost Software License 1.0
9 stars 3 forks source link

No-meld getopt #87

Closed zorael closed 4 years ago

zorael commented 4 years ago

This changes we way we mix getopt with configuration from file.

The previous way was to read getopt flags into members of an instantiated struct, then read the configuration file into members of another struct of the same type, and then meld the two. This caused problems where melding failed due when an overriding getopt false flag failed to overwrite a configuration file true (due to false being indistinguishable from bool.init).

This approach does it serially; reads the configuration file and applies the settings therein to instances of the relevant structs, and then passes the (addresses of) the same member variables to getopt. It's simpler, and we can get rid of the meldSettingsFromFile dance and the adjustGetopt hacks entirely.

So far it seems to work.