Refresh command now supports a package list name as argument.

This commit is contained in:
Dominik Picheta 2016-12-20 20:58:57 +01:00
commit effbfbc6a1
2 changed files with 11 additions and 3 deletions

View file

@ -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:

View file

@ -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.