// query_command public static Value QueryCommand(CallScope args) { Report report = args.FindScope <Report>(); StringBuilder sb = new StringBuilder(); sb.AppendLine("--- Input arguments ---"); sb.AppendLine(args.Value().Dump()); sb.AppendLine(); Query query = new Query(args.Value(), report.WhatToKeep(), report.CollapseHandler.Handled); if (query.HasQuery(QueryKindEnum.QUERY_LIMIT)) { CallScope subArgs = new CallScope(args); subArgs.PushBack(Value.StringValue(query.GetQuery(QueryKindEnum.QUERY_LIMIT))); report.OutputStream.Write(sb.ToString()); ParseCommand(subArgs); } if (query.HasQuery(QueryKindEnum.QUERY_SHOW)) { sb.AppendLine(); sb.AppendLine("====== Display predicate ======"); sb.AppendLine(); CallScope dispSubArgs = new CallScope(args); dispSubArgs.PushBack(Value.StringValue(query.GetQuery(QueryKindEnum.QUERY_SHOW))); report.OutputStream.Write(sb.ToString()); ParseCommand(dispSubArgs); } return(Value.Empty); }
public static Value TemplateCommand(CallScope args) { Report report = args.FindScope <Report>(); StringBuilder sb = new StringBuilder(); sb.AppendLine("--- Input arguments ---"); sb.Append(args.Value().Dump()); sb.AppendLine(); sb.AppendLine(); Draft draft = new Draft(args.Value()); sb.AppendLine("--- Transaction template ---"); sb.Append(draft.Dump()); report.OutputStream.Write(sb.ToString()); return(Value.True); }
public void CallScope_Value_MakesSureThatAllArgumentsAreResolved() { CallScope callScope = new CallScope(new MockScope()); ExprOp testExprOp = new ExprOp(OpKindEnum.VALUE) { AsValue = Value.Get(55) }; callScope.PushFront(Value.Get(testExprOp)); Value result = callScope.Value(); Assert.Equal(55, callScope.Args.AsSequence[0].AsLong); }
public static Value XactCommand(CallScope args) { Report report = args.FindScope <Report>(); Draft draft = new Draft(args.Value()); Xact newXact = draft.Insert(report.Session.Journal); if (newXact != null) { // Only consider actual postings for the "xact" command report.LimitHandler.On("#xact", "actual"); report.XactReport(new PrintXacts(report), newXact); } return(Value.True); }