From 4be5308941653a2de4946083562d7932c9de6c29 Mon Sep 17 00:00:00 2001 From: Leorize Date: Sun, 20 Jan 2019 15:53:06 +0700 Subject: [PATCH] config: don't error out if no package list found --- src/nimblepkg/config.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/nimblepkg/config.nim b/src/nimblepkg/config.nim index 78e3950..5706485 100644 --- a/src/nimblepkg/config.nim +++ b/src/nimblepkg/config.nim @@ -68,11 +68,12 @@ proc parseConfig*(): Config = var e = next(p) case e.kind of cfgEof: - if currentPackageList.urls.len == 0 and currentPackageList.path == "": - raise newException(NimbleError, "Package list '$1' requires either url or path" % currentPackageList.name) - if currentPackageList.urls.len > 0 and currentPackageList.path != "": - raise newException(NimbleError, "Attempted to specify `url` and `path` for the same package list '$1'" % currentPackageList.name) - addCurrentPkgList(result, currentPackageList) + if currentSection.len > 0: + if currentPackageList.urls.len == 0 and currentPackageList.path == "": + raise newException(NimbleError, "Package list '$1' requires either url or path" % currentPackageList.name) + if currentPackageList.urls.len > 0 and currentPackageList.path != "": + raise newException(NimbleError, "Attempted to specify `url` and `path` for the same package list '$1'" % currentPackageList.name) + addCurrentPkgList(result, currentPackageList) break of cfgSectionStart: addCurrentPkgList(result, currentPackageList)