Add a getter for all defined Sections in parsecfg (#15450)

This commit is contained in:
Ardek Romak
2021-03-28 19:57:40 +03:00
committed by GitHub
parent eb3ed44009
commit 207bcabdf2
3 changed files with 17 additions and 14 deletions

View File

@@ -174,6 +174,7 @@ runnableExamples:
import strutils, lexbase, streams, tables
import std/private/decode_helpers
import std/private/since
include "system/inclrtl"
@@ -649,3 +650,8 @@ proc delSectionKey*(dict: var Config, section, key: string) =
dict.del(section)
else:
dict[section].del(key)
iterator sections*(dict: Config): lent string {.since: (1, 5).} =
## Iterates through the sections in the `dict`.
for section in dict.keys:
yield section