Merge pull request #9917 from timotheecour/pr_dump_msg

enhance `dump --dump.format:json` : report `out`, `hints`, `warnings`, document it ; closes #9513
This commit is contained in:
Andreas Rumpf 2018-12-11 22:01:28 +01:00 • committed by GitHub
commit d20a273215
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -266,11 +266,27 @@ proc mainCommand*(graph: ModuleGraph) =
var libpaths = newJArray() var libpaths = newJArray()
for dir in conf.searchPaths: libpaths.elems.add(%dir.string) for dir in conf.searchPaths: libpaths.elems.add(%dir.string)
var hints = block: # consider factoring with `listHints`
var ret = newJObject()
for a in hintMin..hintMax:
let key = lineinfos.HintsToStr[ord(a) - ord(hintMin)]
ret[key] = % (a in conf.notes)
ret
var warnings = block: # consider factoring with `listWarnings`
var ret = newJObject()
for a in warnMin..warnMax:
let key = lineinfos.WarningsToStr[ord(a) - ord(warnMin)]
ret[key] = % (a in conf.notes)
ret
var dumpdata = % [ var dumpdata = % [
(key: "version", val: %VersionAsString), (key: "version", val: %VersionAsString),
(key: "project_path", val: %conf.projectFull.string), (key: "project_path", val: %conf.projectFull.string),
(key: "defined_symbols", val: definedSymbols), (key: "defined_symbols", val: definedSymbols),
(key: "lib_paths", val: libpaths) (key: "lib_paths", val: %libpaths),
(key: "out", val: %conf.outFile.string),
(key: "hints", val: hints),
(key: "warnings", val: warnings),
] ]
msgWriteln(conf, $dumpdata, {msgStdout, msgSkipHook}) msgWriteln(conf, $dumpdata, {msgStdout, msgSkipHook})

View file

@ -13,6 +13,7 @@ Advanced commands:
//genDepend generate a DOT file containing the //genDepend generate a DOT file containing the
module dependency graph module dependency graph
//dump dump all defined conditionals and search paths //dump dump all defined conditionals and search paths
see also: --dump.format:json (useful with: ` | jq`)
//check checks the project for syntax and semantic //check checks the project for syntax and semantic
Advanced options: Advanced options: