fix setCommand so it behaves like regular nim invocation (#18555)

This commit is contained in:
Timothee Cour 2021-07-21 23:00:29 -07:00 • committed by GitHub
commit d5b5827bc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 18 deletions

View file

@ -151,18 +151,9 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
setResult(a, strutils.cmpIgnoreCase(a.getString 0, a.getString 1))
cbconf setCommand:
conf.setCommandEarly(a.getString 0)
# xxx move remaining logic to commands.nim or other
let arg = a.getString 1
incl(conf.globalOptions, optWasNimscript)
if arg.len > 0:
conf.projectName = arg
let path =
if conf.projectName.isAbsolute: AbsoluteFile(conf.projectName)
else: conf.projectPath / RelativeFile(conf.projectName)
try:
conf.projectFull = canonicalizePath(conf, path)
except OSError:
conf.projectFull = path
if arg.len > 0: setFromProjectName(conf, arg)
cbconf getCommand:
setResult(a, conf.command)
cbconf switch: