Warning, /frameworks/syntax-highlighting/autotests/input/craftenv.ps1 is written in an unsupported language. File is not indexed.
0001 <# 0002 .SYNOPSIS 0003 Lorem ipsum dolor sit amet. 0004 0005 .DESCRIPTION 0006 Lorem ipsum dolor sit amet, consectetur adipiscing elit, 0007 sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 0008 0009 .PARAMETER InputPath 0010 Lorem ipsum dolor sit amet, consectetur adipiscing elit. 0011 0012 .parameter InputPath 0013 Lorem ipsum dolor sit amet, consectetur adipiscing elit. 0014 0015 bla .PARAMETER InputPath 0016 Lorem ipsum dolor sit amet, consectetur adipiscing elit. 0017 0018 .EXAMPLE 0019 PS> .\foo.ps1 0020 #> 0021 0022 @" multi 0023 line 0024 string 0025 $x 0026 "' 0027 \n 0028 "@ 0029 "@ 0030 0031 @' multi 0032 line 0033 string 0034 $x 0035 "' 0036 \n 0037 '@ 0038 '@ 0039 0040 $foo = "Test `u{2013} String`nwith `"escapes`" """ 0041 $foo = "Test `u{2013} String`nwith `"escapes`" ` 0042 dssad" 0043 $foo = 'bla bla''bla bla $x `n' 0044 $Global:HOME = "abc" 0045 0046 [bool]::Parse('false') 0047 0048 echo [bool]::Parse('false') 0049 echo $env:EDITOR ${env:EDITOR} $foo ${foo} $foo-bar ${foo-bar} ${a b 0050 c} 0051 echo "hashtable: $(@{ key = 'value' })" 0052 echo 122.42kb 332.d 23d 625 3232e+2 0x233 0b1101 0053 echo 0xaj 0b1112 123a 0054 0055 docker run -dp 3000:3000 ` 0056 -w /app -v "$(pwd):/app" ` 0057 --network todo-app ` 0058 -e MYSQL_HOST=mysql ` 0059 -e MYSQL_USER=root ` 0060 -e MYSQL_PASSWORD=secret ` 0061 -e MYSQL_DB=todos ` 0062 node:12-alpine ` 0063 cmd "npm install && npm run start" 0064 0065 0066 function Get-NewPix 0067 { 0068 $start = Get-Date -Month 1 -Day 1 -Year 2010 0069 $allpix = Get-ChildItem -Path $env:UserProfile\*.jpg -Recurse 0070 $allpix | Where-Object {$_.LastWriteTime -gt $Start} 0071 } 0072 0073 function Get-SmallFiles { 0074 Param($Size) 0075 Get-ChildItem $HOME | Where-Object { 0076 $_.Length -lt $Size -and !$_.PSIsContainer 0077 } 0078 } 0079 0080 function Get-EscapedPath 0081 { 0082 param( 0083 [Parameter( 0084 Position=0, 0085 Mandatory=$true 0086 ValueFromPipeline=$true, 0087 ValueFromPipelineByPropertyName=$true) 0088 ] 0089 [string]$path 0090 ) 0091 0092 process { 0093 if ($path.Contains(' ')) 0094 { 0095 return '"' + $path + '"' 0096 } 0097 return $path 0098 } 0099 } 0100 0101 <# 0102 Copied from Craft for testing syntax highlighting 0103 #> 0104 0105 # this file sets some environment variables that are needed 0106 # for finding programs and libraries etc. 0107 # by Hannah von Reth <vonreth@kde.org> 0108 # you should copy kdesettings.ini to ..\etc\kdesettings.ini 0109 # and adapt it to your needs (see that file for more info) 0110 0111 # this file should contain all path settings - and provide thus an environment 0112 # to build and run kde programs 0113 # based on kdeenv.bat 0114 0115 cls 0116 0117 0118 $env:CraftRoot=[System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Definition) 0119 0120 $CRAFT_ARGUMENTS = $args 0121 0122 &{ 0123 [version]$minPythonVersion = 3.6 0124 0125 function findPython([string] $name) 0126 { 0127 $py = (Get-Command $name -ErrorAction SilentlyContinue) 0128 if ($py -and ($py | Get-Member Version) -and $py.Version -ge $minPythonVersion) { 0129 $env:CRAFT_PYTHON=$py.Source 0130 } 0131 } 0132 0133 findPython("python3") 0134 findPython("python") 0135 0136 function readINI([string] $fileName) 0137 { 0138 $ini = @{} 0139 0140 switch -regex -file $fileName { 0141 "^\[(.+)\]$" { 0142 $section = $matches[1].Trim() 0143 $ini[$section] = @{} 0144 } 0145 "^\s*([^#].+?)\s*=\s*(.*)" { 0146 $name,$value = $matches[1..2] 0147 $ini[$section][$name] = $value.Trim() 0148 } 0149 } 0150 $ini 0151 } 0152 0153 0154 0155 if(test-path -path $env:CraftRoot\..\etc\kdesettings.ini) 0156 { 0157 $settings = readINI $env:CraftRoot\..\etc\kdesettings.ini 0158 } 0159 else 0160 { 0161 Write-Error("$env:CraftRoot\..\etc\kdesettings.ini Does not exist") 0162 break 0163 } 0164 if( $CRAFT_ARGUMENTS[0] -eq "--get") 0165 { 0166 Write-Host($settings[$CRAFT_ARGUMENTS[1]][$CRAFT_ARGUMENTS[2]]) 0167 break 0168 } 0169 0170 0171 function prependPATH([string] $path) 0172 { 0173 $env:PATH="$path{0}$env:PATH" -f [IO.Path]::PathSeparator 0174 } 0175 0176 if( -Not $env:CRAFT_PYTHON) 0177 { 0178 prependPATH $settings["Paths"]["Python"] 0179 $env:CRAFT_PYTHON=[IO.PATH]::COMBINE($settings["Paths"]["Python"], "python") 0180 } 0181 0182 (& $env:CRAFT_PYTHON ([IO.PATH]::COMBINE("$env:CraftRoot", "bin", "CraftSetupHelper.py")) "--setup") | 0183 foreach { 0184 if ($_ -match "=") { 0185 $v = $_.split("=") 0186 set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" 0187 #Write-Host("$v[0]=$v[1]") 0188 } 0189 } 0190 0191 cd "$env:KDEROOT" 0192 } 0193 0194 0195 function Global:craft() { 0196 return & $env:CRAFT_PYTHON ([IO.PATH]::COMBINE("$env:CraftRoot", "bin", "craft.py")) $args 0197 } 0198 0199 0200 if($args.Length -ne 0) 0201 { 0202 invoke-expression -command "$args" 0203 }