for v0.4.0
parent
98b029c96f
commit
00f3570258
16
Home.md
16
Home.md
|
@ -13,7 +13,7 @@ Singleton for reading the configuration file required for your program.
|
||||||
|
|
||||||
### Simple configuration file
|
### Simple configuration file
|
||||||
|
|
||||||
An example of a simple configuration file consists of strings of the format `<parameter><separator><value>`. 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 `<parameter><separator><value>`. 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
|
```conf
|
||||||
parameter1=value1
|
parameter1=value1
|
||||||
|
@ -32,6 +32,7 @@ parameter11 = value11
|
||||||
|
|
||||||
|
|
||||||
parameter12_ => value12
|
parameter12_ => value12
|
||||||
|
parameter13 =
|
||||||
```
|
```
|
||||||
|
|
||||||
### Commenting on lines
|
### Commenting on lines
|
||||||
|
@ -46,10 +47,11 @@ parameter3 => value3 // This will be a comment
|
||||||
parameter4 => value4 /* This will be a comment
|
parameter4 => value4 /* This will be a comment
|
||||||
parameter5 => value5;This will not be a comment
|
parameter5 => value5;This will not be a comment
|
||||||
parameter6 => value6// This will also be a whole value
|
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
|
parameter8 => "//value8" # Now the value is correctly
|
||||||
parameter9 => ';value9' // The value is correctly too
|
parameter9 => ';value9' // The value is correctly too
|
||||||
parameter10 => '"value10"' // Quotes inside
|
parameter10 => '"value10"' // Quotes inside
|
||||||
|
parameter11 => ; empty value
|
||||||
```
|
```
|
||||||
|
|
||||||
### Sections
|
### 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 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:
|
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:
|
||||||
|
|
Loading…
Reference in New Issue