readconf 0.3.0
Singleton for simple reading of the configuration file
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
<p align="center">
<img src="img/logo.png" width=320>
</p>
<h1 align="center">readconf</h1>
Singleton for reading the configuration file required for your program.
What can do
- Reading multiple configuration files
- Separation of parameters by sections
- Access to parameters and sections using keys and indexes
- Commenting on lines
You will get more detailed information on the wiki.
Quick start
The settings.conf
file (see the tests):
Read settings.conf
file:
import readconf;
import std.stdio;
void main()
{
rc.read("./tests/settings.conf");
foreach (key, param; rc.sn.keys())
writefln("%s => %s", key, param);
writeln(rc.sn.key("value1"));
foreach (key, param; rc.sn("part2").keys())
writefln("%s => %s", key, param);
writeln(rc["part2"]["value1"]);
}
Result:
value1 => text without quotes
value2 => Yes!
value3 => value in apostrophes
value4 => 1000
value5 => 0.000
value7 => //path
value8 => "Hey!"
text without quotes
value1 => this value will be in the new section
value3 => good value!
this value will be in the new section
Unittests
The unittests provide examples of configuration files and the settings.conf
file located in the tests:
Running bin/readconf-test-unittest
✓ test __unittest_L4_C1
✓ test __unittest_L106_C1
✓ test __unittest_L25_C1
✓ test __unittest_L51_C1
Summary: 4 passed, 0 failed in 7 ms
DUB
Add a dependency on "readconf": "~>0.3.0"
- Registered by Alexander Zhirov
- 0.3.0 released a year ago
- AlexanderZhirov/readconf
- git.zhirov.kz/dlang/readconf.git
- GPL-2.0
- © Alexander Zhirov, 2023
- Authors:
- Dependencies:
- singlog
- Versions:
-
0.4.1 2024-Feb-09 0.4.0 2023-Jun-07 0.3.1 2023-Apr-29 0.3.0 2023-Mar-30 0.2.0 2023-Mar-26 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
1 downloads this month
-
57 downloads total
-
- Score:
- 0.4
- Short URL:
- readconf.dub.pm