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
commit 207bcabdf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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