public static IExecutionContext CreateEmptyModule(IExecutionContext ctx, string name) { IExecutionContext module = ctx.CreateChildContext(); ctx.DefineVariable(name, new ConstantVariable(new GenericValue<IExecutionContext>(module))); return module; }
public static void ContextRegistration(IExecutionContext ctx) { ctx.DefineVariable("null", new ConstantVariable(GenericValue<object>.Default)); ctx.DefineVariable("true", new ConstantVariable(new GenericValue<bool>(true))); ctx.DefineVariable("false", new ConstantVariable(new GenericValue<bool>(false))); }
public static IValue Define(IExecutionContext ctx, IList<IArgument> arguments) { var args = CommandUtilities.ManageArguments(arguments) .Between(1, 2) .CanConvert<string>(0) .Results(); switch(args.Length) { case 1: ctx.DefineVariable(args[0].GetValue<string>(), new BasicVariable() { Value = GenericValue<object>.Default }); break; case 2: ctx.DefineVariable(args[0].GetValue<string>(), new BasicVariable() { Value = args[1] }); break; } return new GenericValue<bool>(true); }
public static void ContextRegistration(IExecutionContext ctx) { ctx.DefineVariable("cwd", new ConstantVariable(new GenericValue<string>(Directory.GetCurrentDirectory()))); }