Implements check command.

This commit is contained in:
Dominik Picheta 2017-10-15 15:28:29 +01:00
commit c7b97bb206
7 changed files with 94 additions and 5 deletions

View file

@ -329,6 +329,16 @@ proc readPackageInfo(nf: NimbleFile, options: Options,
validateVersion(result.version)
validatePackageInfo(result, options)
proc validate*(file: NimbleFile, options: Options,
error: var ValidationError, pkgInfo: var PackageInfo): bool =
try:
pkgInfo = readPackageInfo(file, options)
except ValidationError as exc:
error = exc[]
return false
return true
proc getPkgInfoFromFile*(file: NimbleFile, options: Options): PackageInfo =
## Reads the specified .nimble file and returns its data as a PackageInfo
## object. Any validation errors are handled and displayed as warnings.