From 2c338d6a9d585dee8a1e19e24addec2c5ce05409 Mon Sep 17 00:00:00 2001 From: rexim Date: Wed, 30 Oct 2019 23:56:00 +0700 Subject: [PATCH] Introduce comments to the config syntax --- src/config.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.nim b/src/config.nim index 2b3569f..9597fe0 100644 --- a/src/config.nim +++ b/src/config.nim @@ -41,7 +41,10 @@ macro parseObject(obj: typed, key, val: string) = proc loadConfig*(filePath: string): Config = 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 key = pair[0].strip let value = pair[1].strip