aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitsunyan2018-06-03 00:40:48 +0000
committerkitsunyan2018-06-03 00:40:48 +0000
commit935031e8f559f06d5d9880707dfa96168a145e7d (patch)
tree83fc49e14c543e604fa695e271582797fdacfea4
parent0b350aab70e5f3535d111d281586dd36174a0ed8 (diff)
Recognize comments only at the beginning of line in config file
-rw-r--r--src/config.nim10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/config.nim b/src/config.nim
index be27291..f391884 100644
--- a/src/config.nim
+++ b/src/config.nim
@@ -61,14 +61,8 @@ proc readConfigFile*(configFile: string):
var matches: array[2, string]
while true:
- let rawLine = readLine(file).strip(leading = false, trailing = true)
- let commentIndex = rawLine.find('#')
- let line = if commentIndex >= 0:
- rawLine[0 .. commentIndex - 1].strip(leading = false, trailing = true)
- else:
- rawLine
-
- if line.len > 0:
+ let line = readLine(file).strip(leading = false, trailing = true)
+ if line.len > 0 and line[0] != '#':
if line.match(re"\[(.*)\]", matches):
currentCategory = matches[0]
if table.hasKey(currentCategory):