From e32e2cdcbeb6c344abab389750e40316d9659f43 Mon Sep 17 00:00:00 2001 From: Xiao-Yong Date: Thu, 21 Dec 2017 17:43:59 -0600 Subject: [PATCH] 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 --- src/nimblepkg/options.nim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nimblepkg/options.nim b/src/nimblepkg/options.nim index 4af9f0c..b220b42 100644 --- a/src/nimblepkg/options.nim +++ b/src/nimblepkg/options.nim @@ -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 = ""