Adds update suggestion to failed install commands.
The install proc checks the didUpdatePackages first to avoid infinite recursion.
This commit is contained in:
parent
58ee3a5d81
commit
e08f9101b8
1 changed files with 10 additions and 2 deletions
12
babel.nim
12
babel.nim
|
|
@ -296,14 +296,22 @@ proc install(packages: seq[String], verRange: PVersionRange): string =
|
|||
result = installFromDir(getCurrentDir(), false)
|
||||
else:
|
||||
if not existsFile(babelDir / "packages.json"):
|
||||
quit("Please run babel update.", QuitFailure)
|
||||
if didUpdatePackages == false and prompt("Local packages.json not found, download it from internet?"):
|
||||
update()
|
||||
install(packages, verRange)
|
||||
else:
|
||||
quit("Please run babel update.", QuitFailure)
|
||||
for p in packages:
|
||||
var pkg: TPackage
|
||||
if getPackage(p, babelDir / "packages.json", pkg):
|
||||
let downloadDir = downloadPkg(pkg, verRange)
|
||||
result = installFromDir(downloadDir, false)
|
||||
else:
|
||||
raise newException(EBabel, "Package not found.")
|
||||
if didUpdatePackages == false and prompt(p & " not found in local packages.json, check internet for updated packages?"):
|
||||
update()
|
||||
install(@[p], verRange)
|
||||
else:
|
||||
raise newException(EBabel, "Package not found.")
|
||||
|
||||
proc build =
|
||||
var pkgInfo = getPkgInfo(getCurrentDir())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue