From 00f3570258892ea8c5bc18592dffa1bab2f0b91d Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Wed, 7 Jun 2023 23:39:40 +0300 Subject: [PATCH] for v0.4.0 --- Home.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Home.md b/Home.md index a05a905..30de93a 100644 --- a/Home.md +++ b/Home.md @@ -13,7 +13,7 @@ Singleton for reading the configuration file required for your program. ### Simple configuration file -An example of a simple configuration file consists of strings of the format ``. The **parameter** has a strict notation using characters `A-Z`, `a-z`, `0-9`, `_`, `-`. The **value** is specified by any set of characters (except *special characters*). The `=` or `=>` symbol can act as a separator. Spaces or tabs are possible between all three parts of the template, as well as before or after. +An example of a simple configuration file consists of strings of the format ``. The **parameter** has a strict notation using characters `A-Z`, `a-z`, `0-9`, `_`, `-`. The **value** is specified by any set of characters (except *special characters*). The `=` or `=>` symbol can act as a separator. Spaces or tabs are possible between all three parts of the template, as well as before or after. It is acceptable to read **parameter** with empty value. ```conf parameter1=value1 @@ -32,6 +32,7 @@ parameter11 = value11 parameter12_ => value12 +parameter13 = ``` ### Commenting on lines @@ -46,10 +47,11 @@ parameter3 => value3 // This will be a comment parameter4 => value4 /* This will be a comment parameter5 => value5;This will not be a comment parameter6 => value6// This will also be a whole value -parameter7 => //value7 ;The value will not be read +parameter7 => //value7 ;The value will be read as empty value parameter8 => "//value8" # Now the value is correctly parameter9 => ';value9' // The value is correctly too parameter10 => '"value10"' // Quotes inside +parameter11 => ; empty value ``` ### Sections @@ -128,6 +130,16 @@ Getting parameter **values** from the selected **section** is done via the key f } ``` +Checking the **parameter** for an empty value: + +```d +{ + ... + assert(mainSection["parameter13"].empty); + ... +} +``` + ### Reading from various sections Reading a configuration file with different **sections**. The [section.conf](https://git.zhirov.kz/dlang/readconf/src/branch/master/examples/sections.conf) file is taken as the configuration file: