From effbfbc6a1a2d425634272a8c7378472277dcb6d Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 20 Dec 2016 20:58:57 +0100 Subject: [PATCH] Refresh command now supports a package list name as argument. --- src/nimble.nim | 12 ++++++++++-- src/nimblepkg/config.nim | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/nimble.nim b/src/nimble.nim index 293d846..30ae15d 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -90,8 +90,16 @@ proc refresh(options: Options) = display("Success", "Package list downloaded.", Success, HighPriority) break - if parameter.isUrl: - downloadList(PackageList(name: "commandline", urls: @[parameter]), options) + if parameter.len > 0: + if parameter.isUrl: + let cmdLine = PackageList(name: "commandline", urls: @[parameter]) + downloadList(cmdLine, options) + else: + if parameter notin options.config.packageLists: + let msg = "Package list with the specified name not found." + raise newException(NimbleError, msg) + + downloadList(options.config.packageLists[parameter], options) else: # Try each package list in config for name, list in options.config.packageLists: diff --git a/src/nimblepkg/config.nim b/src/nimblepkg/config.nim index 3daf952..8b42f5e 100644 --- a/src/nimblepkg/config.nim +++ b/src/nimblepkg/config.nim @@ -8,7 +8,7 @@ type Config* = object nimbleDir*: string chcp*: bool # Whether to change the code page in .cmd files on Win. - packageLists*: Table[string, PackageList] ## URLs to packages.json files + packageLists*: Table[string, PackageList] ## Names -> packages.json files cloneUsingHttps*: bool # Whether to replace git:// for https:// httpProxy*: Uri # Proxy for package list downloads.