Fix #63 - cmdline and date in toast -n output

This commit is contained in:
Ganesh Viswanathan 2019-01-28 10:52:55 -06:00
commit 62b44fc1e2
2 changed files with 14 additions and 7 deletions

View file

@ -1,4 +1,4 @@
import sequtils, sets, strformat, strutils, tables
import os, sequtils, sets, strformat, strutils, tables, times
import regex
@ -128,9 +128,15 @@ proc searchAst(root: TSNode, astTable: AstTable, nimState: NimState) =
if node == root:
break
proc printNim*(fullpath: string, root: TSNode, astTable: AstTable) =
echo "{.experimental: \"codeReordering\".}"
proc printNimHeader*() =
echo """# Generated at $1
# Command line:
# $2 $3
{.experimental: "codeReordering".}
""" % [$now(), getAppFilename(), commandLineParams().join(" ")]
proc printNim*(fullpath: string, root: TSNode, astTable: AstTable) =
var
nimState = new(NimState)
fp = fullpath.replace("\\", "/")

View file

@ -54,9 +54,7 @@ proc printLisp(root: TSNode) =
break
proc process(path: string, astTable: AstTable) =
if not existsFile(path):
echo "Invalid path " & path
return
doAssert existsFile(path), "Invalid path " & path
var
parser = tsParserNew()
@ -141,7 +139,10 @@ proc main(
if pgrammar:
astTable.printGrammar()
elif source.len != 0:
process(source[0], astTable)
if gStateRT.pnim:
printNimHeader()
for src in source:
process(src, astTable)
when isMainModule:
import cligen