cli: add -noDump flug

This commit is contained in:
z7zmey 2018-06-05 12:22:36 +03:00
parent 22fe72467f
commit 876c5845d9

22
main.go
View File

@ -17,9 +17,11 @@ import (
var wg sync.WaitGroup
var usePhp5 *bool
var noDump *bool
func main() {
usePhp5 = flag.Bool("php5", false, "use PHP5 parserWorker")
noDump = flag.Bool("noDump", false, "disable dumping to stdout")
flag.Parse()
pathCh := make(chan string)
@ -85,17 +87,19 @@ func printer(result <-chan parser.Parser) {
fmt.Println(e)
}
nsResolver := visitor.NewNamespaceResolver()
parserWorker.GetRootNode().Walk(nsResolver)
if !*noDump {
nsResolver := visitor.NewNamespaceResolver()
parserWorker.GetRootNode().Walk(nsResolver)
dumper := visitor.Dumper{
Writer: os.Stdout,
Indent: " | ",
Comments: parserWorker.GetComments(),
Positions: parserWorker.GetPositions(),
NsResolver: nsResolver,
dumper := visitor.Dumper{
Writer: os.Stdout,
Indent: " | ",
Comments: parserWorker.GetComments(),
Positions: parserWorker.GetPositions(),
NsResolver: nsResolver,
}
parserWorker.GetRootNode().Walk(dumper)
}
parserWorker.GetRootNode().Walk(dumper)
wg.Done()
}
}