config - 

class MyIniConfig

super IniConfig

var opt_my = new OptionString("My option", "--my")

init do
    super
    tool_description = "Usage: MyExample [OPTION]... [ARGS]..."
    opts.add_option(opt_my)
end

fun my: String do return opt_my.value or else ini["my"] or else "Default"

end

This time, we define the `my` method to return the option value or the ini
if no option was passed. Finally, if no ini value can be found, we return the
default value.

By default, `IniConfig` looks at a `config.ini` file in the execution directory.
This can be overrided in multiple ways.

First by the app user by setting the `--config` option:

var config = new MyIniConfig config.parse_options(["--config", "my_config.ini"])

assert config.config_file == "my_config.ini"

Default config file can also be changed by the library client through the
`default_config_file` attribute:

config = new MyIniConfig config.default_config_file = "my_config.ini" config.parse_options(["arg"])

assert config.config_file == "my_config.ini"

Or by the library developper in the custom config class:

class MyCustomIniConfig

super IniConfig

redef var default_config_file = "my_config.ini"

end

var config = new MyCustomIniConfig config.parse_options(["arg"])

assert config.config_file == "my_config.ini"

Content