...

Text file src/github.com/alecthomas/chroma/v2/lexers/testdata/powershell.actual

Documentation: github.com/alecthomas/chroma/v2/lexers/testdata

     1Get-ChildItem -Recurse -Force -ErrorAction SilentlyContinue -Name -Path  C:\ *.txt
     2
     3#Requires -modules ModuleName
     4#Requires -Assembly "System.Management.Automation, Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"
     5#Requires -Modules @{ ModuleName="ModuleName"; ModuleVersion="1.2.3" }
     6#Requires -PSSnapin SnapinName -version 1.2
     7#Requires -RunAsAdministrator
     8#Requires -WrongParameter ParamValue
     9
    10<#
    11    Multiline comment
    12    .DESCRIPTION
    13    This is a description
    14#>
    15
    16# this is a comment
    17
    18function test { }
    19class test {}
    20class test2 : test { }
    21
    22@"
    23double quoted $MyVar here string
    24"@
    25
    26@"
    27double quoted ${MyVar} here string
    28"@
    29
    30@"
    31double quoted $(Get-Stuff -Param1 $MyVar ) here string
    32"@
    33
    34@'
    35single quoted $(Get-Stuff -Param1 $MyVar ) here string
    36'@
    37
    38'Single quoted string $MyVar'
    39"Double quoted string $MyVar"
    40"Double quoted string $(Get-Stuff -Param1 $MyVar )"
    41"Double quoted string ${var}"
    42
    43$HashTable =  @{
    44    'Something' = $Var
    45    'Else'      = 'string'
    46}
    47
    48$myvar.'property name in string'
    49[string]::UseMethod(12.34)
    5015gb
    51@{}
    52@()
    53$()
    54$test = C:\test
    55$MyVar = Get-Something -SwitchParam:$false
    56$MyVar.property
    57$MyVar.property.property.somemethod()
    58$global:test
    59$null
    60$true
    61$false
    62
    63Configuration ConfigurationName
    64{
    65    Import-DSCResource -ModuleName MyModule
    66}
    67
    68function Get-Stuff {
    69    [CmdletBinding(SupportsShouldProcess=$true)]
    70    param (
    71        [Parameter(Mandatory=$true, DontShow)]
    72        [ValidateNotNullOrEmpty()]
    73        [ValidateScript({ $_ -ne $null })]
    74        [ValidateRange(0, [int]::MaxValue)]
    75        [Microsoft.PowerShell.Commands.WebRequestMethod]$Param1 = 'Get'
    76    )
    77
    78    Process
    79    {
    80        if ($MyVar -lt (Get-Date).AddSeconds([int](12.4 / 2))) {}
    81    }
    82}

View as plain text