readconf/README.md

43 lines
797 B
Markdown
Raw Permalink Normal View History

2023-03-23 15:10:56 +00:00
# readconf
Singleton for reading the configuration file required for your program.
2023-03-23 23:26:02 +00:00
## Quick start
2023-03-23 15:10:56 +00:00
2023-03-23 23:26:02 +00:00
The `settings.conf` file (see the [tests](tests/)):
![matches.png](img/matches.png)
2023-03-23 15:10:56 +00:00
Read `settings.conf` file:
```d
import readconf;
import std.stdio;
void main()
{
Config.file.read("./settings.conf");
foreach (key, param; Config.file.keys())
writefln("%s => %s", key, param);
2023-03-23 23:26:02 +00:00
writeln(Config.file.key("value1"));
2023-03-23 15:10:56 +00:00
}
```
Result:
```
value1 => This is the full value
value2 => Take the value in quotation marks
value3 => Or take in apostrophes
value4 => You can also comment
value5 => So you can also comment
2023-03-24 05:41:06 +00:00
value6 => "And you can even do that!"
2023-03-23 15:10:56 +00:00
value7 => 1234567890
value8 => 12345.67890
value9 => You can use large margins
value12 => //path
2023-03-23 23:26:02 +00:00
This is the full value
2023-03-23 15:10:56 +00:00
```