Introduce comments to the config syntax

This commit is contained in:
rexim 2019-10-30 23:56:00 +07:00
parent ff660050ff
commit 2c338d6a9d

View File

@ -41,7 +41,10 @@ macro parseObject(obj: typed, key, val: string) =
proc loadConfig*(filePath: string): Config = proc loadConfig*(filePath: string): Config =
result = defaultConfig result = defaultConfig
for line in filePath.lines: for rawLine in filePath.lines:
let line = rawLine.strip
if line.len > 0 and line[0] == '#':
continue
let pair = line.split('=', 1) let pair = line.split('=', 1)
let key = pair[0].strip let key = pair[0].strip
let value = pair[1].strip let value = pair[1].strip