Initialize nimbleDir option from the environment variable NIMBLE_DIR (#417)

* Initialize options from the environment variable NIMBLE_DIR

* Tests for the existence of project.nim file

Matches nim's command line handling of 'nim c project'
The error message also states the files being tested.

* Fix deprecated warnings (#420)

* Fix deprecated warning

* Fix deprecation warnings

* Initialize options from the environment variable NIMBLE_DIR

* inform user about using NIMBLE_DIR env
This commit is contained in:
Xiao-Yong 2017-12-21 17:43:59 -06:00 committed by Dominik Picheta
commit e32e2cdcbe

View file

@ -319,7 +319,7 @@ proc parseFlag*(flag, val: string, result: var Options, kind = cmdLongOption) =
proc initOptions*(): Options =
result.action.typ = actionNil
result.pkgInfoCache = newTable[string, PackageInfo]()
result.nimbleDir = ""
result.nimbleDir = getEnv("NIMBLE_DIR")
result.verbosity = HighPriority
proc parseMisc(options: var Options) =
@ -366,6 +366,11 @@ proc parseCmdLine*(): Options =
if result.action.typ == actionNil and not result.showVersion:
result.showHelp = true
# Inform user that we use their environment variables.
if result.getNimbleDir == getEnv("NIMBLE_DIR"):
display("Info:", "Using the 'NIMBLE_DIR' environment variable.",
priority = HighPriority)
proc getProxy*(options: Options): Proxy =
## Returns ``nil`` if no proxy is specified.
var url = ""