some progress on the nimpretty tool; still not ready

This commit is contained in:
Araq 2017-10-16 00:59:51 +02:00
commit 604a15c0aa
4 changed files with 79 additions and 17 deletions

View file

@ -42,7 +42,8 @@ proc writeVersion() =
proc prettyPrint(infile: string) =
let fileIdx = fileInfoIdx(infile)
let tree = parseFile(fileIdx, newIdentCache())
renderModule(tree, infile, {})
let outfile = changeFileExt(infile, ".pretty.nim")
renderModule(tree, infile, outfile, {})
proc main =
var infile: string
@ -50,7 +51,7 @@ proc main =
for kind, key, val in getopt():
case kind
of cmdArgument:
infile = key
infile = key.addFileExt(".nim")
of cmdLongoption, cmdShortOption:
case normalize(key)
of "help", "h": writeHelp()