< Back

Get-CURaw

Sun Jan 19, 2020 6:23 pm

NAME Get-CURaw



SYNOPSIS

Return the raw content of a ps1 or psm1 file as a AST scriptblock type.





SYNTAX

Get-CURaw [-Path <FileInfo[]>] [<CommonParameters>]





DESCRIPTION

Return the raw content of a ps1 or psm1 file as a AST scriptblock type.





PARAMETERS

-Path <FileInfo[]>



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Path of a ps1 or psm1 file





OUTPUTS

ScriptBlockAST





NOTES





Ref: https://mikefrobbins.com/2018/09/28/lea ... -tree-ast/ for

implementing -raw AST



-------------------------- EXAMPLE 1 --------------------------



PS C:\\PSClassUtils>Get-CURaw -Path .\\Classes\\Private\\01_ClassProperty.ps1



Attributes : {}

UsingStatements : {}

ParamBlock :

BeginBlock :

ProcessBlock :

EndBlock : Class ClassProperty {

[String]$Name

[String]$Type



ClassProperty([String]$Name,[String]$Type){



$this.Name = $Name

$This.Type = $Type



}

}

DynamicParamBlock :

ScriptRequirements :

Extent : Class ClassProperty {

[String]$Name

[String]$Type



ClassProperty([String]$Name,[String]$Type){



$this.Name = $Name

$This.Type = $Type



}

}

Parent :



The cmdlet return an AST type representing the content of the 01_ClassProperty.ps1 file











RELATED LINKS