protected override void ProcessRecord() { var context = RunspaceContext.CurrentThread; var sourceFile = context.SourceFile; var extent = new ResourceExtent( file: sourceFile.Path, startLineNumber: Body.Ast.Extent.StartLineNumber ); // Create PS instance for execution var ps = context.NewPowerShell(); ps.AddCommand(new CmdletInfo(InvokeBlockCmdletName, typeof(InvokeBlockCommand))); //ps.AddParameter(InvokeBlockCmdlet_TypeParameter, NodeType); ps.AddParameter(InvokeBlockCmdlet_BodyParameter, Body); var block = new ScriptDocumentBlock( source: sourceFile, name: Name, //info: helpInfo, body: ps, tag: Tag, extent: extent //type: NodeType //dependsOn: RuleHelper.ExpandRuleName(DependsOn, MyInvocation.ScriptName, source.ModuleName), //configuration: Configure ); WriteObject(block); }
protected override void ProcessRecord() { var context = RunspaceContext.CurrentThread; var source = context.Source; var extent = new ResourceExtent( file: source.File.Path, startLineNumber: Body.Ast.Extent.StartLineNumber ); // Create PS instance for execution var ps = context.NewPowerShell(); ps.AddCommand(new CmdletInfo(InvokeCmdletName, typeof(InvokeDocumentCommand))); ps.AddParameter(InvokeCmdlet_IfParameter, If); ps.AddParameter(InvokeCmdlet_WithParameter, With); ps.AddParameter(InvokeCmdlet_BodyParameter, Body); var block = new ScriptDocumentBlock( source: source.File, name: Name, body: ps, tag: Tag, extent: extent ); WriteObject(block); }