diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-05-16 04:09:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 13:09:18 +0200 |
commit | c777f2fb608e1f42daf31d314dda0050f6354acd (patch) | |
tree | 1fa2341dda9dc9da49fc5745360c81cc023d5b26 /compiler/docgen.nim | |
parent | c32e1378eb7d62d59c9e24322c282556c821030a (diff) | |
download | Nim-c777f2fb608e1f42daf31d314dda0050f6354acd.tar.gz |
fix some issues with --backend (#14363)
* fix some issues with --backend * fix https://github.com/timotheecour/Nim/issues/175; improve upon #14306
Diffstat (limited to 'compiler/docgen.nim')
-rw-r--r-- | compiler/docgen.nim | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim index d774fd508..b594921ae 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -216,13 +216,20 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef, # Include the current file if we're parsing a nim file let importStmt = if d.isPureRst: "" else: "import \"$1\"\n" % [d.filename.replace("\\", "/")] writeFile(outp, importStmt & content) - let c = if cmd.startsWith("nim <backend> "): os.getAppFilename() & " " & $conf.backend & cmd.substr("nim <backend>".len) - elif cmd.startsWith("nim "): os.getAppFilename() & cmd.substr("nim".len) - else: cmd - let c2 = c % quoteShell(outp) - rawMessage(conf, hintExecuting, c2) - if execShellCmd(c2) != status: - rawMessage(conf, errGenerated, "executing of external program failed: " & c2) + + proc interpSnippetCmd(cmd: string): string = + # backward compatibility hacks; interpolation commands should explicitly use `$` + if cmd.startsWith "nim ": result = "$nim " & cmd[4..^1] + else: result = cmd + result = result.replace("$1", "$options") % [ + "nim", os.getAppFilename().quoteShell, + "backend", $d.conf.backend, + "options", outp.quoteShell, + ] + let cmd = cmd.interpSnippetCmd + rawMessage(conf, hintExecuting, cmd) + if execShellCmd(cmd) != status: + rawMessage(conf, errGenerated, "executing of external program failed: " & cmd) result.emitted = initIntSet() result.destFile = getOutFile2(conf, presentationPath(conf, filename), outExt, htmldocsDir, false) |