feat: explanation as observer too
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"git.maximhutz.com/max/lambda/internal/cli"
|
||||
"git.maximhutz.com/max/lambda/internal/config"
|
||||
"git.maximhutz.com/max/lambda/internal/executer"
|
||||
"git.maximhutz.com/max/lambda/internal/explanation"
|
||||
"git.maximhutz.com/max/lambda/internal/performance"
|
||||
"git.maximhutz.com/max/lambda/internal/statistics"
|
||||
"git.maximhutz.com/max/lambda/pkg/convert"
|
||||
@@ -43,20 +44,23 @@ func main() {
|
||||
logger.Info("compiled lambda expression", "tree", lambda.Stringify(compiled))
|
||||
}
|
||||
|
||||
process := executer.New(options)
|
||||
process := executer.New(options, &compiled)
|
||||
if options.Profile != "" {
|
||||
profiler := performance.Track(options.Profile)
|
||||
process.On("start", profiler.Start)
|
||||
process.On("end", profiler.End)
|
||||
}
|
||||
|
||||
if options.Explanation {
|
||||
explanation.Track(process)
|
||||
}
|
||||
|
||||
statistics := statistics.Track()
|
||||
process.On("start", statistics.Start)
|
||||
process.On("step", statistics.Step)
|
||||
process.On("end", statistics.End)
|
||||
|
||||
process.Run(&compiled)
|
||||
cli.HandleError(err)
|
||||
process.Run()
|
||||
|
||||
fmt.Println(lambda.Stringify(compiled))
|
||||
fmt.Fprint(os.Stderr, statistics.Results.String())
|
||||
|
||||
Reference in New Issue
Block a user